+
+static void switch_to_romdir(void)
+{
+ char buff[256];
+ int r;
+
+ file_open(romdir_file, "romdir.txt", read);
+
+ if(file_check_valid(romdir_file))
+ {
+ r = file_read(romdir_file, buff, sizeof(buff) - 1);
+ if (r > 0)
+ {
+ buff[r] = 0;
+ while (r > 0 && isspace(buff[r-1]))
+ buff[--r] = 0;
+ chdir(buff);
+ }
+ file_close(romdir_file);
+ }
+}
+
+static void save_romdir(void)
+{
+ char buff[512];
+
+ snprintf(buff, sizeof(buff), "%s" PATH_SEPARATOR "romdir.txt", main_path);
+ file_open(romdir_file, buff, write);
+
+ if(file_check_valid(romdir_file))
+ {
+ if (getcwd(buff, sizeof(buff)))
+ {
+ file_write(romdir_file, buff, strlen(buff));
+ }
+ file_close(romdir_file);
+ }
+}
+#else
+void ChangeWorkingDirectory(char *exe) {}
+static void switch_to_romdir(void) {}
+static void save_romdir(void) {}