mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-12-13 16:45:46 +00:00
Merge pull request #4214 from thedax/adjustLogDirectory
Non-USING_GLES2 platforms: Move default log file location.
This commit is contained in:
commit
d8fe69c5cf
@ -172,7 +172,6 @@
|
||||
<ClInclude Include="ChunkFile.h" />
|
||||
<ClInclude Include="Common.h" />
|
||||
<ClInclude Include="CommonFuncs.h" />
|
||||
<ClInclude Include="CommonPaths.h" />
|
||||
<ClInclude Include="CommonTypes.h" />
|
||||
<ClInclude Include="CommonWindows.h" />
|
||||
<ClInclude Include="ConsoleListener.h" />
|
||||
|
@ -9,7 +9,6 @@
|
||||
<ClInclude Include="ChunkFile.h" />
|
||||
<ClInclude Include="Common.h" />
|
||||
<ClInclude Include="CommonFuncs.h" />
|
||||
<ClInclude Include="CommonPaths.h" />
|
||||
<ClInclude Include="CommonTypes.h" />
|
||||
<ClInclude Include="ConsoleListener.h" />
|
||||
<ClInclude Include="CPUDetect.h" />
|
||||
|
@ -1,81 +0,0 @@
|
||||
// Copyright (C) 2003 Dolphin Project.
|
||||
|
||||
// This program is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, version 2.0 or later versions.
|
||||
|
||||
// This program is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License 2.0 for more details.
|
||||
|
||||
// A copy of the GPL 2.0 should have been included with the program.
|
||||
// If not, see http://www.gnu.org/licenses/
|
||||
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#ifndef _COMMON_PATHS_H_
|
||||
#define _COMMON_PATHS_H_
|
||||
|
||||
// Make sure we pick up USER_DIR if set in config.h
|
||||
#include "Common.h"
|
||||
|
||||
// Directory seperators, do we need this?
|
||||
#define DIR_SEP "/"
|
||||
#ifdef _WIN32
|
||||
#define DIR_SEP_CHRS "/\\"
|
||||
#else
|
||||
#define DIR_SEP_CHRS "/"
|
||||
#endif
|
||||
|
||||
// The user data dir
|
||||
#define ROOT_DIR "."
|
||||
#ifdef _WIN32
|
||||
#define USERDATA_DIR "User"
|
||||
#define DOLPHIN_DATA_DIR "Dolphin"
|
||||
#elif defined __APPLE__
|
||||
// On OS X, USERDATA_DIR exists within the .app, but *always* reference
|
||||
// the copy in Application Support instead! (Copied on first run)
|
||||
// You can use the File::GetUserPath() util for this
|
||||
#define USERDATA_DIR "Contents/Resources/User"
|
||||
#define DOLPHIN_DATA_DIR "Library/Application Support/Dolphin"
|
||||
#else
|
||||
#define USERDATA_DIR "user"
|
||||
#ifdef USER_DIR
|
||||
#define DOLPHIN_DATA_DIR USER_DIR
|
||||
#else
|
||||
#define DOLPHIN_DATA_DIR ".dolphin"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Shared data dirs (Sys and shared User for linux)
|
||||
#ifdef _WIN32
|
||||
#define SYSDATA_DIR "Sys"
|
||||
#elif defined __APPLE__
|
||||
#define SYSDATA_DIR "Contents/Resources/Sys"
|
||||
#define SHARED_USER_DIR File::GetBundleDirectory() + \
|
||||
DIR_SEP USERDATA_DIR DIR_SEP
|
||||
#else
|
||||
#ifdef DATA_DIR
|
||||
#define SYSDATA_DIR DATA_DIR "sys"
|
||||
#define SHARED_USER_DIR DATA_DIR USERDATA_DIR DIR_SEP
|
||||
#else
|
||||
#define SYSDATA_DIR "sys"
|
||||
#define SHARED_USER_DIR ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP
|
||||
#endif
|
||||
#endif
|
||||
|
||||
// Subdirs in the User dir returned by GetUserPath(D_USER_IDX)
|
||||
#define CONFIG_DIR "Config"
|
||||
#define SCREENSHOTS_DIR "ScreenShots"
|
||||
#define LOGS_DIR "Logs"
|
||||
|
||||
// Filenames
|
||||
// Files in the directory returned by GetUserPath(D_CONFIG_IDX)
|
||||
#define CONFIG_FILE "ppsspp.ini"
|
||||
|
||||
// Files in the directory returned by GetUserPath(D_LOGS_IDX)
|
||||
#define MAIN_LOG "ppsspp.log"
|
||||
|
||||
#endif // _COMMON_PATHS_H_
|
@ -15,7 +15,6 @@
|
||||
// Official SVN repository and contact information can be found at
|
||||
// http://code.google.com/p/dolphin-emu/
|
||||
|
||||
#include "CommonPaths.h"
|
||||
#include "FileUtil.h"
|
||||
#include "StringUtils.h"
|
||||
|
||||
@ -53,6 +52,13 @@
|
||||
#define fstat64 fstat
|
||||
#endif
|
||||
|
||||
#define DIR_SEP "/"
|
||||
#ifdef _WIN32
|
||||
#define DIR_SEP_CHRS "/\\"
|
||||
#else
|
||||
#define DIR_SEP_CHRS "/"
|
||||
#endif
|
||||
|
||||
// Hack
|
||||
#if defined(__SYMBIAN32__)
|
||||
static inline int readdir_r(DIR *dirp, struct dirent *entry, struct dirent **result) {
|
||||
@ -635,22 +641,6 @@ bool SetCurrentDir(const std::string &directory)
|
||||
return __chdir(directory.c_str()) == 0;
|
||||
}
|
||||
|
||||
#if defined(__APPLE__)
|
||||
std::string GetBundleDirectory()
|
||||
{
|
||||
CFURLRef BundleRef;
|
||||
char AppBundlePath[MAXPATHLEN];
|
||||
// Get the main bundle for the app
|
||||
BundleRef = CFBundleCopyBundleURL(CFBundleGetMainBundle());
|
||||
CFStringRef BundlePath = CFURLCopyFileSystemPath(BundleRef, kCFURLPOSIXPathStyle);
|
||||
CFStringGetFileSystemRepresentation(BundlePath, AppBundlePath, sizeof(AppBundlePath));
|
||||
CFRelease(BundleRef);
|
||||
CFRelease(BundlePath);
|
||||
|
||||
return AppBundlePath;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
std::wstring &GetExeDirectory()
|
||||
{
|
||||
@ -666,55 +656,6 @@ std::wstring &GetExeDirectory()
|
||||
}
|
||||
#endif
|
||||
|
||||
std::string GetSysDirectory()
|
||||
{
|
||||
std::string sysDir;
|
||||
|
||||
#if defined (__APPLE__)
|
||||
sysDir = GetBundleDirectory();
|
||||
sysDir += DIR_SEP;
|
||||
sysDir += SYSDATA_DIR;
|
||||
#else
|
||||
sysDir = SYSDATA_DIR;
|
||||
#endif
|
||||
sysDir += DIR_SEP;
|
||||
|
||||
INFO_LOG(COMMON, "GetSysDirectory: Setting to %s:", sysDir.c_str());
|
||||
return sysDir;
|
||||
}
|
||||
|
||||
// Returns a string with a Dolphin data dir or file in the user's home
|
||||
// directory. To be used in "multi-user" mode (that is, installed).
|
||||
std::string &GetUserPath(const unsigned int DirIDX, const std::string &newPath)
|
||||
{
|
||||
static std::string paths[NUM_PATH_INDICES];
|
||||
|
||||
// Set up all paths and files on the first run
|
||||
if (paths[D_USER_IDX].empty())
|
||||
{
|
||||
#ifdef _WIN32
|
||||
// TODO: use GetExeDirectory() here instead of ROOT_DIR so that if the cwd is changed we still have the correct paths?
|
||||
paths[D_USER_IDX] = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP;
|
||||
#elif defined(__SYMBIAN32__)
|
||||
paths[D_USER_IDX] = "E:" DIR_SEP "PPSSPP" DIR_SEP;
|
||||
#else
|
||||
if (File::Exists(ROOT_DIR DIR_SEP USERDATA_DIR))
|
||||
paths[D_USER_IDX] = ROOT_DIR DIR_SEP USERDATA_DIR DIR_SEP;
|
||||
else
|
||||
paths[D_USER_IDX] = std::string(getenv("HOME")) + DIR_SEP DOLPHIN_DATA_DIR DIR_SEP;
|
||||
#endif
|
||||
INFO_LOG(COMMON, "GetUserPath: Setting user directory to %s:", paths[D_USER_IDX].c_str());
|
||||
|
||||
paths[D_CONFIG_IDX] = paths[D_USER_IDX] + CONFIG_DIR DIR_SEP;
|
||||
paths[D_SCREENSHOTS_IDX] = paths[D_USER_IDX] + SCREENSHOTS_DIR DIR_SEP;
|
||||
paths[D_LOGS_IDX] = paths[D_USER_IDX] + LOGS_DIR DIR_SEP;
|
||||
paths[F_CONFIG_IDX] = paths[D_CONFIG_IDX] + CONFIG_FILE;
|
||||
paths[F_MAINLOG_IDX] = paths[D_LOGS_IDX] + MAIN_LOG;
|
||||
}
|
||||
|
||||
return paths[DirIDX];
|
||||
}
|
||||
|
||||
IOFile::IOFile()
|
||||
: m_file(NULL), m_good(true)
|
||||
{}
|
||||
|
@ -26,17 +26,6 @@
|
||||
|
||||
#include "Common.h"
|
||||
|
||||
// User directory indices for GetUserPath
|
||||
enum {
|
||||
D_USER_IDX,
|
||||
D_SCREENSHOTS_IDX,
|
||||
D_LOGS_IDX,
|
||||
D_CONFIG_IDX,
|
||||
F_CONFIG_IDX,
|
||||
F_MAINLOG_IDX,
|
||||
NUM_PATH_INDICES
|
||||
};
|
||||
|
||||
#ifdef _WIN32
|
||||
inline struct tm* localtime_r(const time_t *clock, struct tm *result) {
|
||||
if (localtime_s(result, clock) == 0)
|
||||
@ -113,17 +102,6 @@ void CopyDir(const std::string &source_path, const std::string &dest_path);
|
||||
// Set the current directory to given directory
|
||||
bool SetCurrentDir(const std::string &directory);
|
||||
|
||||
// Returns a pointer to a string with a Dolphin data dir in the user's home
|
||||
// directory. To be used in "multi-user" mode (that is, installed).
|
||||
std::string &GetUserPath(const unsigned int DirIDX, const std::string &newPath="");
|
||||
|
||||
// Returns the path to where the sys file are
|
||||
std::string GetSysDirectory();
|
||||
|
||||
#ifdef __APPLE__
|
||||
std::string GetBundleDirectory();
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
std::wstring &GetExeDirectory();
|
||||
#endif
|
||||
|
@ -95,7 +95,7 @@ LogManager::LogManager() {
|
||||
|
||||
// Remove file logging on small devices
|
||||
#if !defined(USING_GLES2) || defined(_DEBUG)
|
||||
fileLog_ = new FileLogListener(File::GetUserPath(F_MAINLOG_IDX).c_str());
|
||||
fileLog_ = new FileLogListener("");
|
||||
consoleLog_ = new ConsoleListener();
|
||||
debuggerLog_ = new DebuggerLogListener();
|
||||
#else
|
||||
|
Loading…
Reference in New Issue
Block a user