mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-03-29 22:20:48 +00:00
windows: move logs to log dir
This commit is contained in:
parent
451e953d26
commit
a7edfa221e
@ -2152,6 +2152,16 @@ const std::string& fs::get_cache_dir()
|
|||||||
return s_dir;
|
return s_dir;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const std::string& fs::get_log_dir()
|
||||||
|
{
|
||||||
|
#ifdef _WIN32
|
||||||
|
static const std::string s_dir = fs::get_config_dir() + "log/";
|
||||||
|
return s_dir;
|
||||||
|
#else
|
||||||
|
return fs::get_cache_dir();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
const std::string& fs::get_temp_dir()
|
const std::string& fs::get_temp_dir()
|
||||||
{
|
{
|
||||||
static const std::string s_dir = []
|
static const std::string s_dir = []
|
||||||
|
@ -605,6 +605,9 @@ namespace fs
|
|||||||
// Get common cache directory
|
// Get common cache directory
|
||||||
const std::string& get_cache_dir();
|
const std::string& get_cache_dir();
|
||||||
|
|
||||||
|
// Get common log directory
|
||||||
|
const std::string& get_log_dir();
|
||||||
|
|
||||||
// Temporary directory
|
// Temporary directory
|
||||||
const std::string& get_temp_dir();
|
const std::string& get_temp_dir();
|
||||||
|
|
||||||
|
@ -347,9 +347,40 @@ void Emulator::Init()
|
|||||||
{
|
{
|
||||||
jit_runtime::initialize();
|
jit_runtime::initialize();
|
||||||
|
|
||||||
|
const std::string emu_dir = rpcs3::utils::get_emu_dir();
|
||||||
|
auto make_path_verbose = [&](const std::string& path, bool must_exist_outside_emu_dir)
|
||||||
|
{
|
||||||
|
if (fs::is_dir(path))
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (must_exist_outside_emu_dir)
|
||||||
|
{
|
||||||
|
const std::string parent = fs::get_parent_dir(path);
|
||||||
|
const std::string emu_dir_no_delim = emu_dir.substr(0, emu_dir.find_last_not_of(fs::delim) + 1);
|
||||||
|
|
||||||
|
if (parent != emu_dir_no_delim && GetCallbacks().resolve_path(parent) != GetCallbacks().resolve_path(emu_dir_no_delim))
|
||||||
|
{
|
||||||
|
sys_log.fatal("Cannot use '%s' for Virtual File System because it does not exist.\nPlease specify an existing and writable directory path in Toolbar -> Manage -> Virtual File System.", path);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!fs::create_path(path))
|
||||||
|
{
|
||||||
|
sys_log.fatal("Failed to create path: %s (%s)", path, fs::g_tls_error);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
|
||||||
if (!g_tty)
|
if (!g_tty)
|
||||||
{
|
{
|
||||||
const auto tty_path = fs::get_cache_dir() + "TTY.log";
|
make_path_verbose(fs::get_log_dir(), true);
|
||||||
|
|
||||||
|
const auto tty_path = fs::get_log_dir() + "TTY.log";
|
||||||
g_tty.open(tty_path, fs::rewrite + fs::append);
|
g_tty.open(tty_path, fs::rewrite + fs::append);
|
||||||
|
|
||||||
if (!g_tty)
|
if (!g_tty)
|
||||||
@ -402,7 +433,6 @@ void Emulator::Init()
|
|||||||
sys_log.notice("Using VFS config:\n%s", g_cfg_vfs.to_string());
|
sys_log.notice("Using VFS config:\n%s", g_cfg_vfs.to_string());
|
||||||
|
|
||||||
// Mount all devices
|
// Mount all devices
|
||||||
const std::string emu_dir = rpcs3::utils::get_emu_dir();
|
|
||||||
const std::string elf_dir = fs::get_parent_dir(m_path);
|
const std::string elf_dir = fs::get_parent_dir(m_path);
|
||||||
const std::string dev_bdvd = g_cfg_vfs.get(g_cfg_vfs.dev_bdvd, emu_dir); // Only used for make_path
|
const std::string dev_bdvd = g_cfg_vfs.get(g_cfg_vfs.dev_bdvd, emu_dir); // Only used for make_path
|
||||||
const std::string dev_hdd0 = g_cfg_vfs.get(g_cfg_vfs.dev_hdd0, emu_dir);
|
const std::string dev_hdd0 = g_cfg_vfs.get(g_cfg_vfs.dev_hdd0, emu_dir);
|
||||||
@ -502,34 +532,6 @@ void Emulator::Init()
|
|||||||
g_backup_cfg.from_string(g_cfg.to_string());
|
g_backup_cfg.from_string(g_cfg.to_string());
|
||||||
|
|
||||||
// Create directories (can be disabled if necessary)
|
// Create directories (can be disabled if necessary)
|
||||||
auto make_path_verbose = [&](const std::string& path, bool must_exist_outside_emu_dir)
|
|
||||||
{
|
|
||||||
if (fs::is_dir(path))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (must_exist_outside_emu_dir)
|
|
||||||
{
|
|
||||||
const std::string parent = fs::get_parent_dir(path);
|
|
||||||
const std::string emu_dir_no_delim = emu_dir.substr(0, emu_dir.find_last_not_of(fs::delim) + 1);
|
|
||||||
|
|
||||||
if (parent != emu_dir_no_delim && GetCallbacks().resolve_path(parent) != GetCallbacks().resolve_path(emu_dir_no_delim))
|
|
||||||
{
|
|
||||||
sys_log.fatal("Cannot use '%s' for Virtual File System because it does not exist.\nPlease specify an existing and writable directory path in Toolbar -> Manage -> Virtual File System.", path);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!fs::create_path(path))
|
|
||||||
{
|
|
||||||
sys_log.fatal("Failed to create path: %s (%s)", path, fs::g_tls_error);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
const std::string save_path = dev_hdd0 + "home/" + m_usr + "/savedata/";
|
const std::string save_path = dev_hdd0 + "home/" + m_usr + "/savedata/";
|
||||||
const std::string user_path = dev_hdd0 + "home/" + m_usr + "/localusername";
|
const std::string user_path = dev_hdd0 + "home/" + m_usr + "/localusername";
|
||||||
|
|
||||||
@ -3636,7 +3638,7 @@ void Emulator::Kill(bool allow_autoexit, bool savestate, savestate_stage* save_s
|
|||||||
|
|
||||||
if (usz attempted_read_size = utils::sub_saturate<usz>(g_tty.pos(), m_tty_file_init_pos))
|
if (usz attempted_read_size = utils::sub_saturate<usz>(g_tty.pos(), m_tty_file_init_pos))
|
||||||
{
|
{
|
||||||
if (fs::file tty_read_fd{fs::get_cache_dir() + "TTY.log"})
|
if (fs::file tty_read_fd{fs::get_log_dir() + "TTY.log"})
|
||||||
{
|
{
|
||||||
// Enforce an arbitrary limit for now to avoid OOM in case the guest code has bombarded TTY
|
// Enforce an arbitrary limit for now to avoid OOM in case the guest code has bombarded TTY
|
||||||
// 3MB, this should be enough
|
// 3MB, this should be enough
|
||||||
|
@ -569,7 +569,7 @@ int main(int argc, char** argv)
|
|||||||
}
|
}
|
||||||
|
|
||||||
const std::string lock_name = fs::get_cache_dir() + "RPCS3.buf";
|
const std::string lock_name = fs::get_cache_dir() + "RPCS3.buf";
|
||||||
const std::string log_name = fs::get_cache_dir() + "RPCS3.log";
|
const std::string log_name = fs::get_log_dir() + "RPCS3.log";
|
||||||
|
|
||||||
static fs::file instance_lock;
|
static fs::file instance_lock;
|
||||||
|
|
||||||
|
@ -157,7 +157,7 @@ log_frame::log_frame(std::shared_ptr<gui_settings> _gui_settings, QWidget* paren
|
|||||||
setWidget(m_tabWidget);
|
setWidget(m_tabWidget);
|
||||||
|
|
||||||
// Open or create TTY.log
|
// Open or create TTY.log
|
||||||
m_tty_file.open(fs::get_cache_dir() + "TTY.log", fs::read + fs::create);
|
m_tty_file.open(fs::get_log_dir() + "TTY.log", fs::read + fs::create);
|
||||||
|
|
||||||
CreateAndConnectActions();
|
CreateAndConnectActions();
|
||||||
LoadSettings();
|
LoadSettings();
|
||||||
|
@ -2676,8 +2676,8 @@ void main_window::CreateConnects()
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const std::string archived_path = fs::get_cache_dir() + "RPCS3.log.gz";
|
const std::string archived_path = fs::get_log_dir() + "RPCS3.log.gz";
|
||||||
const std::string raw_file_path = fs::get_cache_dir() + "RPCS3.log";
|
const std::string raw_file_path = fs::get_log_dir() + "RPCS3.log";
|
||||||
|
|
||||||
fs::stat_t raw_stat{};
|
fs::stat_t raw_stat{};
|
||||||
fs::stat_t archived_stat{};
|
fs::stat_t archived_stat{};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user