From 389bb15501aa06eb8c92a1dd3ae7afcfad121556 Mon Sep 17 00:00:00 2001 From: alex Date: Wed, 14 Nov 2007 16:41:17 +0000 Subject: [PATCH] Patch level : 4.0 810 Files correlati : xvaga.dll Ricompilazione Demo : [ ] Commento : Bug 0000774 La xvt_fsys_parse_filename non gestisce il path in formato UNC git-svn-id: svn://10.65.10.50/trunk@15756 c028cbd2-c16b-5b4b-a496-9718f37d4682 --- xvaga/xvaga.cpp | 60 ++++++++++++++++++++++++++++++++++++------------- 1 file changed, 44 insertions(+), 16 deletions(-) diff --git a/xvaga/xvaga.cpp b/xvaga/xvaga.cpp index 0285b5c27..f7bb944a8 100755 --- a/xvaga/xvaga.cpp +++ b/xvaga/xvaga.cpp @@ -1938,10 +1938,14 @@ static FL_STATUS xvt_dm_post_file_ask(FILE_SPEC *fsp, const char *msg, int flags if (selectedname.IsEmpty()) return FL_CANCEL; - wxFileName::SplitPath(selectedname, &path, &name, &extension); - strcpy(fsp->dir.path, path); - strcpy(fsp->name, MakeFileName(name, extension)); - strcpy(fsp->type, extension); +// wxFileName::SplitPath(selectedname, &path, &name, &extension); +// strcpy(fsp->dir.path, path); +// strcpy(fsp->name, MakeFileName(name, extension)); +// strcpy(fsp->type, extension); + char pathname[_MAX_PATH]; + + xvt_fsys_parse_pathname(selectedname, fsp->dir.path, pathname, fsp->name, fsp->type, NULL); + strcat(fsp->dir.path, pathname); return FL_OK; } @@ -3042,18 +3046,29 @@ BOOLEAN xvt_fsys_parse_pathname(const char *mbs, char *volname, char *dirname, c wxFileName::SplitPath(mbs, &volume, &path, &file, &ext); if (volname) { + if (mbs[0] == '\\' && mbs[1] == '\\') + { + volume.insert(0, "\\\\"); + if (path[0] != '\\' && path[0] != '/') + volume << '/'; + path.insert(0, volume); + *volname = '\0'; + } + else + { strcpy(volname, volume); #ifdef WIN32 if (volname[0] != '\0' && volname[1] == '\0') strcat(volname, ":"); #endif } + } if (dirname) strcpy(dirname, path); if (leafroot) strcpy(leafroot, file); if (leafext) strcpy(leafext, ext); if (leafvers) strcpy(leafvers, ""); // TBI put here last change date/time? - return TRUE; -} + return true; + } BOOLEAN xvt_fsys_convert_dir_to_str(DIRECTORY *dirp, char *path, int sz_path) { @@ -3086,14 +3101,20 @@ BOOLEAN xvt_fsys_convert_str_to_fspec(const char *mbs, FILE_SPEC *fs) BOOLEAN ok = FALSE; if (mbs && *mbs && fs != NULL) { - wxString volume, path, file, ext; - wxFileName::SplitPath(mbs, &volume, &path, &file, &ext); + char path[_MAX_PATH]; + + xvt_fsys_parse_pathname(mbs, fs->dir.path, path, fs->name, fs->type, NULL); + strcat(fs->dir.path, path); - xvt_fsys_convert_str_to_dir(volume+path, &fs->dir); - wxStrncpy(fs->type, ext, sizeof(fs->type)); - wxStrncpy(fs->name, file, SZ_FNAME); +// wxString volume, path, file, ext; +// wxFileName::SplitPath(mbs, &volume, &path, &file, &ext); + +// xvt_fsys_convert_str_to_dir(volume+path, &fs->dir); +// wxStrncpy(fs->type, ext, sizeof(fs->type)); +// wxStrncpy(fs->name, file, SZ_FNAME); wxStrcpy(fs->creator, "CAMPO"); - ok = !file.IsEmpty(); +// ok = !file.IsEmpty(); + ok = fs->name[0] != '\0'; } return ok; } @@ -3160,14 +3181,21 @@ BOOLEAN xvt_fsys_is_fixed_drive(const char* path) static unsigned long compute_disk_size(const char* path, bool tot, char unit) { #ifdef WIN32 - char drive[_MAX_DRIVE+1]; - xvt_fsys_parse_pathname(path, drive, NULL, NULL, NULL, NULL); + char drive[_MAX_DRIVE + 1]; + char pathname[_MAX_PATH]; + + xvt_fsys_parse_pathname(path, drive, pathname, NULL, NULL, NULL); + if (strlen(drive) > 0) strcat(drive, "/"); DWORD nSecPerClust, nBytePerSec, nFreeClust, nTotalClust; - ::GetDiskFreeSpace(drive, &nSecPerClust, &nBytePerSec, &nFreeClust, &nTotalClust); - __int64 nBytes = tot ? nTotalClust : nFreeClust; + __int64 nBytes = 0; + + if (::GetDiskFreeSpace( *drive ? drive : pathname, &nSecPerClust, &nBytePerSec, &nFreeClust, &nTotalClust) != 0) + { + nBytes = tot ? nTotalClust : nFreeClust; nBytes *= nSecPerClust; nBytes *= nBytePerSec; + } #else int64_t nBytes = OsLinux_GetDiskFreeSpace(path);