diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2007-07-11 04:00:00 +0400 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:52 +0300 |
commit | 7038848692e7049234f223703522681a19db49a5 (patch) | |
tree | 38c5acef39a775a1f58f81b13be81fc6ef8c72e3 /CPP/Windows | |
parent | fd8b1d78b496fe38193bf8c5e86af3b43f0b022d (diff) |
4.49 beta
Diffstat (limited to 'CPP/Windows')
-rwxr-xr-x | CPP/Windows/FileName.cpp | 63 | ||||
-rwxr-xr-x | CPP/Windows/FileName.h | 20 |
2 files changed, 5 insertions, 78 deletions
diff --git a/CPP/Windows/FileName.cpp b/CPP/Windows/FileName.cpp index 49e957cf..57c357ff 100755 --- a/CPP/Windows/FileName.cpp +++ b/CPP/Windows/FileName.cpp @@ -9,13 +9,6 @@ namespace NWindows { namespace NFile { namespace NName { -static const wchar_t kDiskDelimiter = L':'; - -/* -static bool IsCharAPrefixDelimiter(wchar_t c) - { return (c == kDirDelimiter || c == kDiskDelimiter); } -*/ - void NormalizeDirPathPrefix(CSysString &dirPath) { if (dirPath.IsEmpty()) @@ -34,59 +27,7 @@ void NormalizeDirPathPrefix(UString &dirPath) } #endif -namespace NPathType -{ - EEnum GetPathType(const UString &path) - { - if (path.Length() <= 2) - return kLocal; - if (path[0] == kDirDelimiter && path[1] == kDirDelimiter) - return kUNC; - return kLocal; - } -} - -void CParsedPath::ParsePath(const UString &path) -{ - int curPos = 0; - switch (NPathType::GetPathType(path)) - { - case NPathType::kLocal: - { - int posDiskDelimiter = path.Find(kDiskDelimiter); - if(posDiskDelimiter >= 0) - { - curPos = posDiskDelimiter + 1; - if (path.Length() > curPos) - if(path[curPos] == kDirDelimiter) - curPos++; - } - break; - } - case NPathType::kUNC: - { - int curPos = path.Find(kDirDelimiter, 2); - if(curPos < 0) - curPos = path.Length(); - else - curPos++; - } - } - Prefix = path.Left(curPos); - SplitPathToParts(path.Mid(curPos), PathParts); -} - -UString CParsedPath::MergePath() const -{ - UString result = Prefix; - for(int i = 0; i < PathParts.Size(); i++) - { - if (i != 0) - result += kDirDelimiter; - result += PathParts[i]; - } - return result; -} +#ifdef _WIN32 const wchar_t kExtensionDelimiter = L'.'; @@ -108,4 +49,6 @@ void SplitNameToPureNameAndExtension(const UString &fullName, } } +#endif + }}} diff --git a/CPP/Windows/FileName.h b/CPP/Windows/FileName.h index 5b912b2d..2eab2679 100755 --- a/CPP/Windows/FileName.h +++ b/CPP/Windows/FileName.h @@ -17,26 +17,10 @@ void NormalizeDirPathPrefix(CSysString &dirPath); // ensures that it ended with void NormalizeDirPathPrefix(UString &dirPath); // ensures that it ended with '\\' #endif -namespace NPathType -{ - enum EEnum - { - kLocal, - kUNC - }; - EEnum GetPathType(const UString &path); -} - -struct CParsedPath -{ - UString Prefix; // Disk or UNC with slash - UStringVector PathParts; - void ParsePath(const UString &path); - UString MergePath() const; -}; - +#ifdef _WIN32 void SplitNameToPureNameAndExtension(const UString &fullName, UString &pureName, UString &extensionDelimiter, UString &extension); +#endif }}} |