Implement default VMM directory
This commit is contained in:
@@ -143,8 +143,7 @@ load_global(void)
|
||||
if (p != NULL)
|
||||
strncpy(vmm_path, p, sizeof(vmm_path) - 1);
|
||||
else
|
||||
// [todo] plat_vmm_path()
|
||||
vmm_path[0] = 0;
|
||||
plat_get_vmm_dir(vmm_path, sizeof(vmm_path));
|
||||
}
|
||||
|
||||
/* Load "General" section. */
|
||||
@@ -2215,7 +2214,10 @@ save_global(void)
|
||||
else
|
||||
ini_section_delete_var(cat, "vmm_disabled");
|
||||
|
||||
ini_section_set_string(cat, "vmm_path", vmm_path);
|
||||
if (vmm_path[0] != 0)
|
||||
ini_section_set_string(cat, "vmm_path", vmm_path);
|
||||
else
|
||||
ini_section_delete_var(cat, "vmm_path");
|
||||
}
|
||||
|
||||
/* Save "General" section. */
|
||||
|
||||
@@ -146,6 +146,7 @@ extern void plat_get_exe_name(char *s, int size);
|
||||
extern void plat_get_global_config_dir(char *outbuf, size_t len);
|
||||
extern void plat_get_global_data_dir(char *outbuf, size_t len);
|
||||
extern void plat_get_temp_dir(char *outbuf, uint8_t len);
|
||||
extern void plat_get_vmm_dir(char *outbuf, uint8_t len);
|
||||
extern void plat_init_rom_paths(void);
|
||||
extern int plat_dir_check(char *path);
|
||||
extern int plat_dir_create(char *path);
|
||||
|
||||
@@ -694,6 +694,20 @@ plat_get_temp_dir(char *outbuf, const uint8_t len)
|
||||
strncpy(outbuf, dir.canonicalPath().toUtf8().constData(), len);
|
||||
}
|
||||
|
||||
void
|
||||
plat_get_vmm_dir(char *outbuf, const size_t len)
|
||||
{
|
||||
const auto dir = QDir(QStandardPaths::standardLocations(QStandardPaths::HomeLocation)[0]).filePath("86Box VMs");
|
||||
|
||||
if (!dir.exists()) {
|
||||
if (!dir.mkpath(".")) {
|
||||
qWarning("Failed to create VMs directory %s", dir.absolutePath().toUtf8().constData());
|
||||
}
|
||||
}
|
||||
|
||||
strncpy(outbuf, dir.canonicalPath().toUtf8().constData(), len);
|
||||
}
|
||||
|
||||
void
|
||||
plat_init_rom_paths(void)
|
||||
{
|
||||
|
||||
@@ -901,6 +901,14 @@ plat_get_temp_dir(char *outbuf, uint8_t len)
|
||||
path_slash(outbuf);
|
||||
}
|
||||
|
||||
void
|
||||
plat_get_vmm_dir(char *outbuf, const size_t len)
|
||||
{
|
||||
// Return empty string. SDL 86Box does not have a VM manager
|
||||
if (len > 0)
|
||||
outbuf[0] = 0;
|
||||
}
|
||||
|
||||
bool
|
||||
process_media_commands_3(uint8_t *id, char *fn, uint8_t *wp, int cmdargc)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user