mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-01-31 01:15:24 +01:00
FileSystem: Add CreateSymLink function
This commit is contained in:
@@ -1961,6 +1961,26 @@ bool FileSystem::SetPathCompression(const char* path, bool enable)
|
||||
return result;
|
||||
}
|
||||
|
||||
bool FileSystem::CreateSymLink(const char* link, const char* target)
|
||||
{
|
||||
// convert to wide string
|
||||
const std::wstring wlink = GetWin32Path(link);
|
||||
if (wlink.empty())
|
||||
return false;
|
||||
|
||||
const std::wstring wtarget = GetWin32Path(target);
|
||||
if (wtarget.empty())
|
||||
return false;
|
||||
|
||||
// check if it's a directory
|
||||
DWORD flags = 0;
|
||||
if (DirectoryExists(target))
|
||||
flags |= SYMBOLIC_LINK_FLAG_DIRECTORY;
|
||||
|
||||
// create the symbolic link
|
||||
return CreateSymbolicLinkW(wlink.c_str(), wtarget.c_str(), flags) != 0;
|
||||
}
|
||||
|
||||
bool FileSystem::IsSymbolicLink(const char* path)
|
||||
{
|
||||
// convert to wide string
|
||||
@@ -2541,6 +2561,11 @@ bool FileSystem::SetPathCompression(const char* path, bool enable)
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FileSystem::CreateSymLink(const char* link, const char* target)
|
||||
{
|
||||
return symlink(target, link) == 0;
|
||||
}
|
||||
|
||||
bool FileSystem::IsSymbolicLink(const char* path)
|
||||
{
|
||||
struct stat sysStatData;
|
||||
|
||||
Reference in New Issue
Block a user