diff --git a/unix/src/TUnixSystem.cxx b/unix/src/TUnixSystem.cxx index a04678f99b0f562b8d998e75cd870a4f65628679..2de29629af72d46eff9d62493aa69c92fb1d6761 100644 --- a/unix/src/TUnixSystem.cxx +++ b/unix/src/TUnixSystem.cxx @@ -1,4 +1,4 @@ -// @(#)root/unix:$Name: $:$Id: TUnixSystem.cxx,v 1.142 2005/09/13 10:20:30 rdm Exp $ +// @(#)root/unix:$Name: $:$Id: TUnixSystem.cxx,v 1.143 2005/09/24 11:57:36 rdm Exp $ // Author: Fons Rademakers 15/09/95 /************************************************************************* @@ -38,6 +38,7 @@ #include "TObjString.h" #include "Riostream.h" #include "TVirtualMutex.h" +#include "TUrl.h" //#define G__OLDEXPAND @@ -1205,7 +1206,7 @@ Bool_t TUnixSystem::AccessPathName(const char *path, EAccessMode mode) if (helper) return helper->AccessPathName(path, mode); - if (::access(path, mode) == 0) + if (::access(TUrl(path, kTRUE).GetFile(), mode) == 0) return kFALSE; fLastErrorString = GetError(); return kTRUE; @@ -3318,7 +3319,7 @@ int TUnixSystem::UnixMakedir(const char *dir) // -1 if the directory could not be created (either already exists or // illegal path name). - return ::mkdir(dir, 0755); + return ::mkdir(TUrl(dir, kTRUE).GetFile(), 0755); } //______________________________________________________________________________ @@ -3328,13 +3329,15 @@ void *TUnixSystem::UnixOpendir(const char *dir) struct stat finfo; - if (stat(dir, &finfo) < 0) + TString edir = TUrl(dir, kTRUE).GetFile(); + + if (stat(edir, &finfo) < 0) return 0; if (!S_ISDIR(finfo.st_mode)) return 0; - return (void*) opendir(dir); + return (void*) opendir(edir); } #if defined(_POSIX_SOURCE) @@ -3372,13 +3375,15 @@ const char *TUnixSystem::UnixGetdirentry(void *dirp1) //---- files ------------------------------------------------------------------- //______________________________________________________________________________ -int TUnixSystem::UnixFilestat(const char *path, FileStat_t &buf) +int TUnixSystem::UnixFilestat(const char *fpath, FileStat_t &buf) { // Get info about a file. Info is returned in the form of a FileStat_t // structure (see TSystem.h). // The function returns 0 in case of success and 1 if the file could // not be stat'ed. + TString path = TUrl(fpath, kTRUE).GetFile(); + #if defined(R__SEEK64) struct stat64 sbuf; if (path && lstat64(path, &sbuf) == 0) { diff --git a/winnt/src/TWinNTSystem.cxx b/winnt/src/TWinNTSystem.cxx index 86c0dc34dcdbe0c854f905adfa19b5c7fc5de08c..44c5f04e41edc0dd387f5f3da195e40119dd79cd 100644 --- a/winnt/src/TWinNTSystem.cxx +++ b/winnt/src/TWinNTSystem.cxx @@ -1,4 +1,4 @@ -// @(#)root/winnt:$Name: $:$Id: TWinNTSystem.cxx,v 1.124 2005/09/24 11:57:36 rdm Exp $ +// @(#)root/winnt:$Name: $:$Id: TWinNTSystem.cxx,v 1.125 2005/10/28 20:36:02 brun Exp $ // Author: Fons Rademakers 15/09/95 /************************************************************************* @@ -39,6 +39,7 @@ #include "TGWin32Command.h" #include "TInterpreter.h" #include "TObjString.h" +#include "TUrl.h" #include <sys/utime.h> #include <process.h> @@ -637,7 +638,7 @@ const char *TWinNTSystem::BaseName(const char *name) // The calling routine should use free() to free memory BaseName allocated // for the base name // BB 28/10/05 : Removed (commented out) StrDup() : - // - To get same behaviour on Windows and on Linux + // - To get same behaviour on Windows and on Linux // - To avoid the need to use #ifdefs // - Solve memory leaks (mainly in TTF::SetTextFont()) // No need for the calling routine to use free() anymore. @@ -1272,11 +1273,11 @@ int TWinNTSystem::MakeDirectory(const char *name) #ifdef WATCOM // It must be as follows if (!name) return 0; - return ::mkdir(name); + return ::mkdir(TUrl(name, kTRUE).GetFile()); #else // but to be in line with TUnixSystem I did like this if (!name) return 0; - return ::_mkdir(name); + return ::_mkdir(TUrl(name, kTRUE).GetFile()); #endif } @@ -1391,15 +1392,17 @@ BOOL PathIsRoot(LPCTSTR pPath) } //______________________________________________________________________________ -void *TWinNTSystem::OpenDirectory(const char *dir) +void *TWinNTSystem::OpenDirectory(const char *fdir) { // Open a directory. Returns 0 if directory does not exist. - TSystem *helper = FindHelper(dir); + TSystem *helper = FindHelper(fdir); if (helper) { - return helper->OpenDirectory(dir); + return helper->OpenDirectory(fdir); } + TString dir = TUrl(fdir, kTRUE).GetFile(); + char *entry = new char[strlen(dir)+3]; struct _stati64 finfo; @@ -1687,12 +1690,11 @@ Bool_t TWinNTSystem::AccessPathName(const char *path, EAccessMode mode) // Attention, bizarre convention of return value!! TSystem *helper = FindHelper(path); - if (helper) { + if (helper) return helper->AccessPathName(path, mode); - } - if (::_access(path, mode) == 0) { + + if (::_access(TUrl(path, kTRUE).GetFile(), mode) == 0) return kFALSE; - } fLastErrorString = GetError(); return kTRUE; } @@ -1765,7 +1767,7 @@ int TWinNTSystem::GetPathInfo(const char *path, FileStat_t &buf) struct _stati64 sbuf; // Remove trailing backslashes - char *newpath = StrDup(path); + char *newpath = StrDup(TUrl(path, kTRUE).GetFile()); int l = strlen(newpath); while (l > 1) { if (newpath[--l] != '\\' || newpath[--l] != '/') {