Files
easy7zip/7zip/UI/Common/ExtractingFilePath.cpp
Igor Pavlov 8c1b5c7b7e 3.13
2016-05-28 00:15:41 +01:00

55 lines
979 B
C++
Executable File

// ExtractingFilePath.cpp
#include "StdAfx.h"
#include "ExtractingFilePath.h"
UString GetCorrectFileName(const UString &path)
{
UString result = path;
result.Trim();
result.Replace(L"..\\", L"");
result.Replace(L"../", L"");
if (result.Length() > 1)
{
if (result[1] == L':')
{
result.Delete(1);
// result.Insert(first + 1, L'_');
}
}
return result;
}
UString GetCorrectPath(const UString &path)
{
UString result = path;
int first;
for (first = 0; first < result.Length(); first++)
if (result[first] != ' ')
break;
while(result.Length() > first)
{
if (result[first] == L'\\' || result[first] == L'/')
{
result.Delete(first);
continue;
}
break;
}
result.Replace(L"..\\", L"");
result.Replace(L"../", L"");
if (result.Length() > 1)
{
if (result[first + 1] == L':')
{
result.Delete(first + 1);
// result.Insert(first + 1, L'_');
}
}
return result;
}