Skip to content

Commit 3fd4410

Browse files
committed
Remove old log file paths so they'll not be mistaken for current logs
1 parent fcb0a41 commit 3fd4410

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

ChangeLog

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
Version 2.3.17:
22

3+
* Remove old log file paths so they'll not be mistaken for current logs.
34
* Fix initial mute when option volume is set to 0.
45
* Updated translations: fi [Goingdown], pl [grimi], fr [Foul].
56
* (Launcher) Option download_file from DB does not have to be an archive.

src/fs-uae/main.c

+27
Original file line numberDiff line numberDiff line change
@@ -767,6 +767,32 @@ static void configure_logging(const char *logstr) {
767767
}
768768
}
769769

770+
static void cleanup_old_file(const char *path) {
771+
char *p = fs_uae_expand_path(path);
772+
if (fs_path_exists(p)) {
773+
if (fs_path_is_dir(p)) {
774+
fs_log("trying to remove old directory %s\n", p);
775+
fs_rmdir(p);
776+
}
777+
else {
778+
fs_log("trying to remove old file %s\n", p);
779+
fs_unlink(p);
780+
}
781+
}
782+
free(p);
783+
}
784+
785+
static void cleanup_old_files() {
786+
// Logs are now stored in $BASE/Cache/Logs by default
787+
cleanup_old_file("$BASE/Logs/FS-UAE.log");
788+
cleanup_old_file("$BASE/Logs/FS-UAE.log.txt");
789+
cleanup_old_file("$BASE/Logs/DebugConfig.uae");
790+
cleanup_old_file("$BASE/Logs/Launcher.log.txt");
791+
cleanup_old_file("$BASE/Logs/Synchronization.log");
792+
// try to remove the dir - if it now is empty
793+
cleanup_old_file("$BASE/Logs");
794+
}
795+
770796
static const char *overlay_names[] = {
771797
"df0_led", // 0
772798
"df1_led", // 1
@@ -1118,5 +1144,6 @@ int main(int argc, char* argv[]) {
11181144
fs_uae_state_dir());
11191145
}
11201146
fs_log("end of main function\n");
1147+
cleanup_old_files();
11211148
return 0;
11221149
}

0 commit comments

Comments
 (0)