mirror of
https://github.com/Xevion/easy7zip.git
synced 2025-12-08 14:07:00 -06:00
55 lines
979 B
C++
Executable File
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;
|
|
|
|
}
|
|
|