Add IsRelativePath helper

This commit is contained in:
Cody Northrop authored and Baldur Karlsson committed 2017-06-23 02:39:11 -07:00
1 parent 506954ffb8
commit 95225d12b4
4 files changed
+20 -1

No files matched your search

+1
View File
@@ -237,6 +237,7 @@ string GetReplayAppFilename();
void CreateParentDirectory(const string &filename);
bool IsRelativePath(const string &path);
string GetFullPathname(const string &filename);
void GetExecutableFilename(string &selfName);
+8
View File
@@ -83,6 +83,14 @@ void CreateParentDirectory(const string &filename)
}
}
bool IsRelativePath(const string &path)
{
if(path.empty())
return false;
return path.front() != '/';
}
string GetFullPathname(const string &filename)
{
char path[PATH_MAX + 1] = {0};
+10
View File
@@ -24,6 +24,7 @@
******************************************************************************/
#include <shlobj.h>
#include <shlwapi.h>
#include <stdio.h>
#include <string.h>
#include <tchar.h>
@@ -166,6 +167,15 @@ void GetExecutableFilename(string &selfName)
selfName = StringFormat::Wide2UTF8(wstring(curFile));
}
bool IsRelativePath(const string &path)
{
if(path.empty())
return false;
wstring wpath = StringFormat::UTF82Wide(path.c_str());
return PathIsRelativeW(wpath.c_str()) != 0;
}
string GetFullPathname(const string &filename)
{
wstring wfn = StringFormat::UTF82Wide(filename);
+1 -1
View File
@@ -77,7 +77,7 @@
</ClCompile>
<Link>
<SubSystem>Windows</SubSystem>
<AdditionalDependencies>ws2_32.lib;kernel32.lib;user32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalDependencies>ws2_32.lib;kernel32.lib;user32.lib;shlwapi.lib;%(AdditionalDependencies)</AdditionalDependencies>
<ModuleDefinitionFile>$(ProjectDir)os\win32\comexport.def</ModuleDefinitionFile>
<GenerateDebugInformation>true</GenerateDebugInformation>
</Link>