This commit is contained in:
Christoph Oelckers 2013-08-31 21:53:11 +02:00
commit bab56106c1
12 changed files with 96 additions and 18 deletions

View file

@ -1569,3 +1569,31 @@ unsigned int I_MakeRNGSeed()
CryptReleaseContext(prov, 0);
return seed;
}
//==========================================================================
//
// I_GetLongPathName
//
// Returns the long version of the path, or the original if there isn't
// anything worth changing.
//
//==========================================================================
FString I_GetLongPathName(FString shortpath)
{
DWORD buffsize = GetLongPathName(shortpath.GetChars(), NULL, 0);
if (buffsize == 0)
{ // nothing to change (it doesn't exist, maybe?)
return shortpath;
}
TCHAR *buff = new TCHAR[buffsize];
DWORD buffsize2 = GetLongPathName(shortpath.GetChars(), buff, buffsize);
if (buffsize2 >= buffsize)
{ // Failure! Just return the short path
delete[] buff;
return shortpath;
}
FString longpath(buff, buffsize2);
delete[] buff;
return longpath;
}

View file

@ -155,6 +155,9 @@ typedef _W64 long WLONG_PTR;
typedef long WLONG_PTR;
#endif
// Wrapper for GetLongPathName
FString I_GetLongPathName(FString shortpath);
// Directory searching routines
// Mirror WIN32_FIND_DATAA in <winbase.h>