Clean up plat.h a bit

This commit is contained in:
David Hrdlička
2022-04-19 23:06:39 +02:00
parent 366b01fef6
commit e60af6c29d
49 changed files with 184 additions and 131 deletions

View File

@@ -91,7 +91,9 @@
#include <86box/snd_speaker.h>
#include <86box/video.h>
#include <86box/ui.h>
#include <86box/path.h>
#include <86box/plat.h>
#include <86box/thread.h>
#include <86box/version.h>
#include <86box/gdbstub.h>
@@ -411,14 +413,14 @@ pc_init(int argc, char *argv[])
/* Grab the executable's full path. */
plat_get_exe_name(exe_path, sizeof(exe_path)-1);
p = plat_get_filename(exe_path);
p = path_get_filename(exe_path);
*p = '\0';
#if !defined(_WIN32) && !defined(__APPLE__)
/* Grab the actual path if we are an AppImage. */
appimage = getenv("APPIMAGE");
if (appimage && (appimage[0] != '\0')) {
plat_get_dirname(exe_path, appimage);
path_get_dirname(exe_path, appimage);
}
#endif
@@ -557,8 +559,8 @@ usage:
if (c != argc) goto usage;
plat_path_slash(usr_path);
plat_path_slash(rom_path);
path_slash(usr_path);
path_slash(rom_path);
/*
* If the user provided a path for files, use that
@@ -567,7 +569,7 @@ usage:
* make it absolute.
*/
if (ppath != NULL) {
if (! plat_path_abs(ppath)) {
if (! path_abs(ppath)) {
/*
* This looks like a relative path.
*
@@ -590,11 +592,11 @@ usage:
}
// Add the VM-local ROM path.
plat_append_filename(temp, usr_path, "roms");
path_append_filename(temp, usr_path, "roms");
rom_add_path(temp);
// Add the standard ROM path in the same directory as the executable.
plat_append_filename(temp, exe_path, "roms");
path_append_filename(temp, exe_path, "roms");
rom_add_path(temp);
plat_init_rom_paths();
@@ -606,7 +608,7 @@ usage:
* make it absolute.
*/
if (rpath != NULL) {
if (! plat_path_abs(rpath)) {
if (! path_abs(rpath)) {
/*
* This looks like a relative path.
*
@@ -641,7 +643,7 @@ usage:
* This can happen when people load a config
* file using the UI, for example.
*/
p = plat_get_filename(cfg);
p = path_get_filename(cfg);
if (cfg != p) {
/*
* OK, the configuration file name has a
@@ -656,19 +658,19 @@ usage:
* Otherwise, assume the pathname given is
* relative to whatever the usr_path is.
*/
if (plat_path_abs(cfg))
if (path_abs(cfg))
strcpy(usr_path, cfg);
else
strcat(usr_path, cfg);
}
/* Make sure we have a trailing backslash. */
plat_path_slash(usr_path);
path_slash(usr_path);
if (rom_path[0] != '\0')
plat_path_slash(rom_path);
path_slash(rom_path);
/* At this point, we can safely create the full path name. */
plat_append_filename(cfg_path, usr_path, p);
path_append_filename(cfg_path, usr_path, p);
/*
* Get the current directory's name
@@ -679,8 +681,8 @@ usage:
*/
if (strlen(vm_name) == 0) {
char ltemp[1024] = { '\0'};
plat_get_dirname(ltemp, usr_path);
strcpy(vm_name, plat_get_filename(ltemp));
path_get_dirname(ltemp, usr_path);
strcpy(vm_name, path_get_filename(ltemp));
}
/*