X-Git-Url: https://feistymeow.org/gitweb/?a=blobdiff_plain;f=nucleus%2Flibrary%2Ffilesystem%2Ffilename.cpp;h=ed7b914aa518d2d1b0c5fb017da2414456d94e22;hb=56a8b71bcfe324f83044a12738004151ff2fc064;hp=664a9970c2e0caf91b1102e63007cc4845b09ef0;hpb=858aef5a060ab5329bf4922eee55bf0119ef77f1;p=feisty_meow.git diff --git a/nucleus/library/filesystem/filename.cpp b/nucleus/library/filesystem/filename.cpp index 664a9970..ed7b914a 100644 --- a/nucleus/library/filesystem/filename.cpp +++ b/nucleus/library/filesystem/filename.cpp @@ -24,10 +24,9 @@ #include #include #include -#ifdef __UNIX__ +#if defined(__UNIX__) || defined(__GNU_WINDOWS__) #include -#endif -#ifdef __WIN32__ +#else #include #endif @@ -191,13 +190,22 @@ void filename::canonicalize() // on windows, we want to translate away from any cygwin or msys format into a more palatable // version that the rest of windows understands. // first, cygwin... - const astring CYGDRIVE_PATH = astring(astring(DEFAULT_SEPARATOR, 1) + "cygdrive" - + astring(DEFAULT_SEPARATOR, 1)); +//hmmm: make these into statics! + const astring CYGDRIVE_SENTINEL = "cygdrive"; + const astring CYGDRIVE_PATH = astring(astring(DEFAULT_SEPARATOR, 1) + + CYGDRIVE_SENTINEL + astring(DEFAULT_SEPARATOR, 1)); + // must be at least as long as the string we're looking for, plus a drive letter afterwards. - if ( (length() > CYGDRIVE_PATH.length() + 1) && begins(CYGDRIVE_PATH) ) { + if ( (length() >= CYGDRIVE_PATH.length() + 1) + && separator(get(0)) + && separator(get(CYGDRIVE_PATH.length() - 1)) + && compare(CYGDRIVE_SENTINEL, 1, + 0, CYGDRIVE_SENTINEL.length(), true) ) { zap(0, CYGDRIVE_PATH.length() - 1); // whack the cygdrive portion plus two slashes. insert(1, ":"); // add a colon after the imputed drive letter. -//LOG(astring("turned cygdrive string into: ") + *this); +//LOG(astring("turned cygdrive path string into: ") + *this); + } else { +//LOG(astring("path didn't match so left as: ") + *this); } // now we convert msys... if ( (length() >= 2) && (get(0) == DEFAULT_SEPARATOR)