diff --git a/.github/workflows/create-release.yml b/.github/workflows/create-release.yml index 01746153..642293ab 100644 --- a/.github/workflows/create-release.yml +++ b/.github/workflows/create-release.yml @@ -133,8 +133,7 @@ jobs: release_name: Release ${{ env.RELEASE_VERSION }} body: | # Changes in this Release - - **CHANGED API** Added `GetParentPath()` to `Storage_API` - - **FIX** EnsureParentPath now handles Windows path with backslashes properly + - **FIX** Properly handle UNC paths draft: false prerelease: false files: "*-x64.zip" diff --git a/cmd/main.c b/cmd/main.c index 9150bf95..286b9bb8 100644 --- a/cmd/main.c +++ b/cmd/main.c @@ -241,6 +241,10 @@ static char* NormalizePath(const char* path) char* normalized_path = Longtail_Strdup(path); size_t wi = 0; size_t ri = 0; + if (normalized_path[0] == '\\' && normalized_path[1] == '\\' && normalized_path[2] == '?' && normalized_path[3] == '\\') + { + ri += 4; + } while (path[ri]) { switch (path[ri]) diff --git a/lib/longtail_platform.c b/lib/longtail_platform.c index 54d8651a..f8ef6641 100644 --- a/lib/longtail_platform.c +++ b/lib/longtail_platform.c @@ -129,6 +129,11 @@ static const wchar_t* MakeLongPath(const wchar_t* path) // Don't add long path prefix if we don't specify a drive return path; } + if (path[0] == '\\' && path[1] == '\\' && path[2] == '?' && path[3] == '\\') + { + // Don't add long path prefix if we aleady have an UNC path + return path; + } size_t path_len = wcslen(path); if (path_len < MAX_PATH) { @@ -374,7 +379,7 @@ static wchar_t* MakePlatformPath(const char* path) wchar_t* p = r; while (*p) { - *r = ((*r) == '/') ? '\\' : (*r); + *p = ((*p) == '/') ? '\\' : (*p); ++p; } return r;