Add export dir to Windows

This commit is contained in:
elasota
2021-05-07 02:12:58 -04:00
parent 0de26b5e71
commit b0d5673d95
2 changed files with 11 additions and 1 deletions

View File

@@ -115,6 +115,7 @@ GpFileSystem_Win32::GpFileSystem_Win32(IGpAllocator *alloc)
, m_userHousesDir(alloc)
, m_userSavesDir(alloc)
, m_resourcesDir(alloc)
, m_exportDir(alloc)
{
m_executablePath[0] = 0;
}
@@ -155,18 +156,23 @@ bool GpFileSystem_Win32::Init()
if (!m_logsDir.Set(m_prefsDir) || !m_logsDir.Append(L"\\Logs"))
return false;
if (!m_exportDir.Set(m_prefsDir) || !m_exportDir.Append(L"\\Export"))
return false;
CreateDirectoryW(m_prefsDir.Buffer(), nullptr);
CreateDirectoryW(m_scoresDir.Buffer(), nullptr);
CreateDirectoryW(m_userHousesDir.Buffer(), nullptr);
CreateDirectoryW(m_userSavesDir.Buffer(), nullptr);
CreateDirectoryW(m_logsDir.Buffer(), nullptr);
CreateDirectoryW(m_exportDir.Buffer(), nullptr);
if (!m_prefsDir.Append(L"\\") ||
!m_scoresDir.Append(L"\\") ||
!m_userHousesDir.Append(L"\\") ||
!m_userSavesDir.Append(L"\\") ||
!m_logsDir.Append(L"\\") ||
!m_resourcesDir.Append(L"\\"))
!m_resourcesDir.Append(L"\\") ||
!m_exportDir.Append(L"\\"))
return false;
DWORD modulePathSize = GetModuleFileNameW(nullptr, m_executablePath, MAX_PATH);
@@ -509,6 +515,9 @@ bool GpFileSystem_Win32::ResolvePath(PortabilityLayer::VirtualDirectory_t virtua
case PortabilityLayer::VirtualDirectories::kLogs:
baseDir = m_logsDir.Buffer();
break;
case PortabilityLayer::VirtualDirectories::kSourceExport:
baseDir = m_exportDir.Buffer();
break;
default:
return false;
}

View File

@@ -42,6 +42,7 @@ private:
GpWString m_userHousesDir;
GpWString m_userSavesDir;
GpWString m_resourcesDir;
GpWString m_exportDir;
wchar_t m_executablePath[MAX_PATH];
IGpAllocator *m_alloc;