Browse Source

Add wchar* versions of some plFile utils.

Darryl Pogue 13 years ago
parent
commit
7ba977a480
  1. 21
      Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp
  2. 2
      Sources/Plasma/PubUtilLib/plFile/plFileUtils.h

21
Sources/Plasma/PubUtilLib/plFile/plFileUtils.cpp

@ -439,7 +439,22 @@ void plFileUtils::AddSlash(char* path)
{ {
char lastChar = path[strlen(path)-1]; char lastChar = path[strlen(path)-1];
if (lastChar != '\\' && lastChar != '/') if (lastChar != '\\' && lastChar != '/')
#if HS_BUILD_FOR_WIN32
strcat(path, "\\"); strcat(path, "\\");
#else
strcat(path, "/");
#endif
}
void plFileUtils::AddSlash(wchar* path)
{
wchar lastChar = path[wcslen(path)-1];
if (lastChar != L'\\' && lastChar != L'/')
#if HS_BUILD_FOR_WIN32
wcscat(path, L"\\");
#else
wcscat(path, L"/");
#endif
} }
void plFileUtils::ConcatFileName(char* path, const char* fileName) void plFileUtils::ConcatFileName(char* path, const char* fileName)
@ -448,6 +463,12 @@ void plFileUtils::ConcatFileName(char* path, const char* fileName)
strcat(path, fileName); strcat(path, fileName);
} }
void plFileUtils::ConcatFileName(wchar* path, const wchar* fileName)
{
AddSlash(path);
wcscat(path, fileName);
}
//// GetFileSize ///////////////////////////////////////////////////////////// //// GetFileSize /////////////////////////////////////////////////////////////
UInt32 plFileUtils::GetFileSize( const char *path ) UInt32 plFileUtils::GetFileSize( const char *path )

2
Sources/Plasma/PubUtilLib/plFile/plFileUtils.h

@ -107,9 +107,11 @@ namespace plFileUtils
// Adds a slash to the end of a filename (or does nothing if it's already there) // Adds a slash to the end of a filename (or does nothing if it's already there)
void AddSlash(char* path); void AddSlash(char* path);
void AddSlash(wchar* path);
// Concatenates fileName onto path, making sure to add a slash if necessary // Concatenates fileName onto path, making sure to add a slash if necessary
void ConcatFileName(char* path, const char* fileName); void ConcatFileName(char* path, const char* fileName);
void ConcatFileName(wchar* path, const wchar* fileName);
// searches the parent directory of filename for the encryption key file, and reads it // searches the parent directory of filename for the encryption key file, and reads it
// into the key passed in. Returns false if the key file didn't exist (and sets key to // into the key passed in. Returns false if the key file didn't exist (and sets key to

Loading…
Cancel
Save