Core: get CSettingTypeSelectedDirectory to Normalize the path
This commit is contained in:
parent
beca3ef513
commit
dd281e4e34
|
@ -1404,7 +1404,7 @@ bool CPath::ChangeDirectory()
|
|||
#endif
|
||||
}
|
||||
|
||||
void CPath::NormalizePath(CPath BaseDir)
|
||||
CPath & CPath::NormalizePath(CPath BaseDir)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
stdstr Directory = BaseDir.GetDriveDirectory();
|
||||
|
@ -1449,6 +1449,7 @@ void CPath::NormalizePath(CPath BaseDir)
|
|||
SetDirectory(Directory.c_str());
|
||||
#endif
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
|
||||
// Pre: If bCreateIntermediates is TRUE, create all eventually missing parent directories too
|
||||
|
|
|
@ -127,7 +127,7 @@ public:
|
|||
// Directory operations
|
||||
bool DirectoryCreate(bool bCreateIntermediates = true);
|
||||
bool ChangeDirectory();
|
||||
void NormalizePath(CPath BaseDir);
|
||||
CPath & NormalizePath(CPath BaseDir);
|
||||
|
||||
// File operations
|
||||
bool Delete(bool bEvenIfReadOnly = true) const;
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
#include "stdafx.h"
|
||||
|
||||
#include "SettingsType-SelectedDirectory.h"
|
||||
#include <Common/path.h>
|
||||
|
||||
CSettingTypeSelectedDirectory::CSettingTypeSelectedDirectory(const char * Name, SettingID InitialDir, SettingID SelectedDir, SettingID UseSelected, SettingID NotifyChangeId) :
|
||||
m_Name(Name),
|
||||
|
@ -41,7 +43,12 @@ bool CSettingTypeSelectedDirectory::Load(uint32_t /*Index*/, uint32_t & /*Value*
|
|||
bool CSettingTypeSelectedDirectory::Load(uint32_t /*Index*/, std::string & Value) const
|
||||
{
|
||||
SettingID DirSettingId = g_Settings->LoadBool(m_UseSelected) ? m_SelectedDir : m_InitialDir;
|
||||
return g_Settings->LoadStringVal(DirSettingId, Value);
|
||||
if (g_Settings->LoadStringVal(DirSettingId, Value))
|
||||
{
|
||||
Value = (const char *)(CPath(Value).NormalizePath(CPath(CPath::MODULE_DIRECTORY)));
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// Return the default values
|
||||
|
|
Loading…
Reference in New Issue