mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-02-02 11:43:31 +00:00
Merge branch 'fileutil' of https://github.com/unknownbrackets/ppsspp into unknownbrackets-fileutil
Conflicts: Core/Dialog/SavedataParam.cpp
This commit is contained in:
commit
2b448bdcad
@ -23,7 +23,11 @@
|
||||
|
||||
// Directory seperators, do we need this?
|
||||
#define DIR_SEP "/"
|
||||
#define DIR_SEP_CHR '/'
|
||||
#ifdef _WIN32
|
||||
#define DIR_SEP_CHRS "/\\"
|
||||
#else
|
||||
#define DIR_SEP_CHRS "/"
|
||||
#endif
|
||||
|
||||
// The user data dir
|
||||
#define ROOT_DIR "."
|
||||
|
@ -102,7 +102,7 @@ void CFileSearch::FindFiles(const std::string& _searchString, const std::string&
|
||||
((s.size() > ext.size()) && (!strcasecmp(s.substr(s.size() - ext.size()).c_str(), ext.c_str())) ))
|
||||
{
|
||||
std::string full_name;
|
||||
if (_strPath.c_str()[_strPath.size()-1] == DIR_SEP_CHR)
|
||||
if (strchr(DIR_SEP_CHRS, _strPath.c_str()[_strPath.size()-1]))
|
||||
full_name = _strPath + s;
|
||||
else
|
||||
full_name = _strPath + DIR_SEP + s;
|
||||
|
@ -66,7 +66,7 @@ static void StripTailDirSlashes(std::string &fname)
|
||||
if (fname.length() > 1)
|
||||
{
|
||||
size_t i = fname.length() - 1;
|
||||
while (fname[i] == DIR_SEP_CHR)
|
||||
while (strchr(DIR_SEP_CHRS, fname[i]))
|
||||
fname[i--] = '\0';
|
||||
}
|
||||
return;
|
||||
@ -188,20 +188,26 @@ bool CreateFullPath(const std::string &fullPath)
|
||||
}
|
||||
|
||||
size_t position = 0;
|
||||
|
||||
#ifdef _WIN32
|
||||
// Skip the drive letter, no need to create C:\.
|
||||
position = 3;
|
||||
#endif
|
||||
|
||||
while (true)
|
||||
{
|
||||
// Find next sub path
|
||||
position = fullPath.find(DIR_SEP_CHR, position);
|
||||
position = fullPath.find_first_of(DIR_SEP_CHRS, position);
|
||||
|
||||
// we're done, yay!
|
||||
if (position == fullPath.npos)
|
||||
{
|
||||
if (!File::IsDirectory(fullPath))
|
||||
if (!File::Exists(fullPath))
|
||||
File::CreateDir(fullPath);
|
||||
return true;
|
||||
}
|
||||
std::string subPath = fullPath.substr(0, position);
|
||||
if (!File::IsDirectory(subPath))
|
||||
if (!File::Exists(subPath))
|
||||
File::CreateDir(subPath);
|
||||
|
||||
// A safety check
|
||||
@ -507,7 +513,7 @@ bool DeleteDirRecursively(const std::string &directory)
|
||||
(virtualName[2] == '\0')))
|
||||
continue;
|
||||
|
||||
std::string newPath = directory + DIR_SEP_CHR + virtualName;
|
||||
std::string newPath = directory + DIR_SEP + virtualName;
|
||||
if (IsDirectory(newPath))
|
||||
{
|
||||
if (!DeleteDirRecursively(newPath))
|
||||
|
@ -211,8 +211,8 @@ void BuildCompleteFilename(std::string& _CompleteFilename, const std::string& _P
|
||||
_CompleteFilename = _Path;
|
||||
|
||||
// check for seperator
|
||||
if (DIR_SEP_CHR != *_CompleteFilename.rbegin())
|
||||
_CompleteFilename += DIR_SEP_CHR;
|
||||
if (!strchr(DIR_SEP_CHRS, *_CompleteFilename.rbegin()))
|
||||
_CompleteFilename += DIR_SEP;
|
||||
|
||||
// add the filename
|
||||
_CompleteFilename += _Filename;
|
||||
|
@ -23,7 +23,7 @@ std::string icon1Name = "ICON1.PNG";
|
||||
std::string pic1Name = "PIC1.PNG";
|
||||
std::string sfoName = "PARAM.SFO";
|
||||
|
||||
std::string savePath = "ms0://PSP/SAVEDATA/";
|
||||
std::string savePath = "ms0:/PSP/SAVEDATA/";
|
||||
|
||||
SavedataParam::SavedataParam()
|
||||
: pspParam(0)
|
||||
@ -254,6 +254,7 @@ bool SavedataParam::GetList(SceUtilitySavedataParam* param)
|
||||
{
|
||||
Memory::Write_U32(0,param->idListAddr+4);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void SavedataParam::SetPspParam(SceUtilitySavedataParam* param)
|
||||
@ -289,7 +290,7 @@ void SavedataParam::SetPspParam(SceUtilitySavedataParam* param)
|
||||
{
|
||||
DEBUG_LOG(HLE,"Name : %s",saveNameListData[i]);
|
||||
|
||||
std::string fileDataPath = savePath+"/"+GetGameName(param)+saveNameListData[i]+"/"+GetFileName(param);
|
||||
std::string fileDataPath = savePath+GetGameName(param)+saveNameListData[i]+"/"+param->fileName;
|
||||
PSPFileInfo info = pspFileSystem.GetFileInfo(fileDataPath);
|
||||
if(info.exists)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user