mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-23 13:30:02 +00:00
Delete unused function, rename two more.
This commit is contained in:
parent
77b8a14770
commit
770f7f60e4
@ -217,7 +217,7 @@ size_t GetFilesInDir(const char *directory, std::vector<FileInfo> * files, const
|
||||
return foundEntries;
|
||||
}
|
||||
|
||||
int64_t getDirectoryRecursiveSize(const std::string & path, const char *filter, int flags) {
|
||||
int64_t GetDirectoryRecursiveSize(const std::string & path, const char *filter, int flags) {
|
||||
std::vector<FileInfo> fileInfo;
|
||||
GetFilesInDir(path.c_str(), &fileInfo, filter, flags);
|
||||
int64_t sizeSum = 0;
|
||||
@ -228,14 +228,14 @@ int64_t getDirectoryRecursiveSize(const std::string & path, const char *filter,
|
||||
if (!finfo.isDirectory)
|
||||
sizeSum += finfo.size;
|
||||
else
|
||||
sizeSum += getDirectoryRecursiveSize(finfo.fullName, filter, flags);
|
||||
sizeSum += GetDirectoryRecursiveSize(finfo.fullName, filter, flags);
|
||||
}
|
||||
return sizeSum;
|
||||
}
|
||||
|
||||
#ifdef _WIN32
|
||||
// Returns a vector with the device names
|
||||
std::vector<std::string> getWindowsDrives()
|
||||
std::vector<std::string> GetWindowsDrives()
|
||||
{
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
return std::vector<std::string>(); // TODO UWP http://stackoverflow.com/questions/37404405/how-to-get-logical-drives-names-in-windows-10
|
||||
|
@ -33,10 +33,10 @@ enum {
|
||||
GETFILES_GETHIDDEN = 1
|
||||
};
|
||||
size_t GetFilesInDir(const char *directory, std::vector<FileInfo> *files, const char *filter = nullptr, int flags = 0);
|
||||
int64_t getDirectoryRecursiveSize(const std::string &path, const char *filter = nullptr, int flags = 0);
|
||||
int64_t GetDirectoryRecursiveSize(const std::string &path, const char *filter = nullptr, int flags = 0);
|
||||
|
||||
#ifdef _WIN32
|
||||
std::vector<std::string> getWindowsDrives();
|
||||
std::vector<std::string> GetWindowsDrives();
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -377,7 +377,6 @@ bool CreateFullPath(const std::string &path)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Deletes a directory filename, returns true on success
|
||||
bool DeleteDir(const std::string &filename)
|
||||
{
|
||||
@ -696,48 +695,6 @@ bool DeleteDirRecursively(const std::string &directory)
|
||||
return File::DeleteDir(directory);
|
||||
}
|
||||
|
||||
|
||||
// Create directory and copy contents (does not overwrite existing files)
|
||||
void CopyDir(const std::string &source_path, const std::string &dest_path)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
if (source_path == dest_path) return;
|
||||
if (!File::Exists(source_path)) return;
|
||||
if (!File::Exists(dest_path)) File::CreateFullPath(dest_path);
|
||||
|
||||
struct dirent *result = NULL;
|
||||
DIR *dirp = opendir(source_path.c_str());
|
||||
if (!dirp) return;
|
||||
|
||||
while ((result = readdir(dirp))) {
|
||||
const std::string virtualName(result->d_name);
|
||||
// check for "." and ".."
|
||||
if (((virtualName[0] == '.') && (virtualName[1] == '\0')) ||
|
||||
((virtualName[0] == '.') && (virtualName[1] == '.') &&
|
||||
(virtualName[2] == '\0'))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string source, dest;
|
||||
source = source_path + virtualName;
|
||||
dest = dest_path + virtualName;
|
||||
if (IsDirectory(source)) {
|
||||
source += '/';
|
||||
dest += '/';
|
||||
if (!File::Exists(dest)) {
|
||||
File::CreateFullPath(dest);
|
||||
}
|
||||
CopyDir(source, dest);
|
||||
} else if (!File::Exists(dest)) {
|
||||
File::Copy(source, dest);
|
||||
}
|
||||
}
|
||||
closedir(dirp);
|
||||
#else
|
||||
ERROR_LOG(COMMON, "CopyDir not supported on this platform");
|
||||
#endif
|
||||
}
|
||||
|
||||
void OpenFileInEditor(const std::string& fileName) {
|
||||
#if defined(_WIN32)
|
||||
#if PPSSPP_PLATFORM(UWP)
|
||||
|
@ -36,7 +36,7 @@ inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
|
||||
|
||||
namespace File {
|
||||
|
||||
// Mostly to handle utf-8 filenames better on Windows.
|
||||
// Mostly to handle UTF-8 filenames better on Windows.
|
||||
FILE *OpenCFile(const std::string &filename, const char *mode);
|
||||
bool OpenCPPFile(std::fstream & stream, const std::string &filename, std::ios::openmode mode);
|
||||
|
||||
@ -78,6 +78,7 @@ bool CreateFullPath(const std::string &fullPath);
|
||||
bool Delete(const std::string &filename);
|
||||
|
||||
// Deletes a directory filename, returns true on success
|
||||
// Directory must be empty.
|
||||
bool DeleteDir(const std::string &filename);
|
||||
|
||||
// renames file srcFilename to destFilename, returns true on success
|
||||
@ -92,9 +93,6 @@ bool CreateEmptyFile(const std::string &filename);
|
||||
// deletes the given directory and anything under it. Returns true on success.
|
||||
bool DeleteDirRecursively(const std::string &directory);
|
||||
|
||||
// Create directory and copy contents (does not overwrite existing files)
|
||||
void CopyDir(const std::string &source_path, const std::string &dest_path);
|
||||
|
||||
// Opens ini file (cheats, texture replacements etc.)
|
||||
// TODO: Belongs in System or something.
|
||||
void OpenFileInEditor(const std::string& fileName);
|
||||
|
@ -246,7 +246,7 @@ bool PathBrowser::GetListing(std::vector<File::FileInfo> &fileInfo, const char *
|
||||
#ifdef _WIN32
|
||||
if (path_ == "/") {
|
||||
// Special path that means root of file system.
|
||||
std::vector<std::string> drives = File::getWindowsDrives();
|
||||
std::vector<std::string> drives = File::GetWindowsDrives();
|
||||
for (auto drive = drives.begin(); drive != drives.end(); ++drive) {
|
||||
if (*drive == "A:/" || *drive == "B:/")
|
||||
continue;
|
||||
|
@ -113,7 +113,7 @@ u64 GameInfo::GetGameSizeInBytes() {
|
||||
switch (fileType) {
|
||||
case IdentifiedFileType::PSP_PBP_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_SAVEDATA_DIRECTORY:
|
||||
return File::getDirectoryRecursiveSize(ResolvePBPDirectory(filePath_), nullptr, File::GETFILES_GETHIDDEN);
|
||||
return File::GetDirectoryRecursiveSize(ResolvePBPDirectory(filePath_), nullptr, File::GETFILES_GETHIDDEN);
|
||||
|
||||
default:
|
||||
return GetFileLoader()->FileSize();
|
||||
|
@ -430,7 +430,7 @@ static time_t GetTotalSize(const SavedataButton *b) {
|
||||
switch (Identify_File(fileLoader.get())) {
|
||||
case IdentifiedFileType::PSP_PBP_DIRECTORY:
|
||||
case IdentifiedFileType::PSP_SAVEDATA_DIRECTORY:
|
||||
return File::getDirectoryRecursiveSize(ResolvePBPDirectory(b->GamePath()), nullptr, File::GETFILES_GETHIDDEN);
|
||||
return File::GetDirectoryRecursiveSize(ResolvePBPDirectory(b->GamePath()), nullptr, File::GETFILES_GETHIDDEN);
|
||||
|
||||
default:
|
||||
return fileLoader->FileSize();
|
||||
|
Loading…
Reference in New Issue
Block a user