--- parser3/src/main/pa_file.C 2026/09/29 02:56:52 1.5 +++ parser3/src/main/pa_file.C 2026/09/30 17:45:25 1.7 @@ -16,7 +16,7 @@ #include #endif -volatile const char * IDENT_PA_FILE_C="$Id: pa_file.C,v 1.5 2026/09/29 02:56:52 moko Exp $" IDENT_PA_FILE_H; +volatile const char * IDENT_PA_FILE_C="$Id: pa_file.C,v 1.7 2026/09/30 17:45:25 moko Exp $" IDENT_PA_FILE_H; // some maybe-undefined constants @@ -75,6 +75,13 @@ const String* file_uri_to_path(const Str } if(is_os_absolute_path(*rest)) return rest; // file://C:/path, not a standard form but in use +#ifdef WIN32 + if(rest->pos('/')!=STRING_NOT_FOUND) { // file://server/share/path is the UNC path \\server\share\path + String& result=*new String("//"); + result << *rest; + return &result; + } +#endif return 0; } @@ -322,7 +329,7 @@ void create_dir_for_file(const String& f const char *str=file_spec.taint_cstr(String::L_FILE_SPEC); if(str[0]){ const char *pos=str+1; - while((pos=strpbrk(pos, "/\\")) && pos[1]) { // to avoid trailing /, see #1166 + while((pos=strchr(pos, '/')) && pos[1]) { // to avoid trailing /, see #1166 pa_mkdir(pa_strdup(str,pos-str), 0775); pos++; } @@ -438,7 +445,7 @@ static size_t get_dir(char* fname, size_ size_t pos=0; for(pos=helper_length; pos; pos--){ char c=fname[pos-1]; - if(c=='/' || c=='\\'){ + if(c=='/'){ fname[pos-1]=0; dir=true; } else if(dir) break; @@ -463,7 +470,7 @@ static bool entry_ifdir(char *fname, boo size_t size=strlen(fname); while(size) { char c=fname[size-1]; - if(c=='/' || c=='\\') + if(c=='/') fname[--size]=0; else break; @@ -544,7 +551,7 @@ bool dir_exists(const String& file_spec) const String* file_exist(const String& path, const String& name) { String& result=*new String(path); - if(path.last_char() != '/' && path.last_char() != '\\') + if(path.last_char() != '/') result << "/"; result << name; return file_exist(result)?&result:0;