mirror of
https://github.com/termux/termux-packages.git
synced 2025-03-04 03:40:08 +00:00
73 lines
1.6 KiB
Diff
73 lines
1.6 KiB
Diff
--- a/frontend/libpicofe/linux/plat.c 2023-01-14 16:15:27.853589338 -0300
|
|
+++ b/frontend/libpicofe/linux/plat.c 2024-07-21 13:30:28.033306193 -0300
|
|
@@ -22,6 +22,7 @@
|
|
#include <sys/stat.h>
|
|
|
|
#include "../plat.h"
|
|
+#include "../../main.h"
|
|
|
|
/* XXX: maybe unhardcode pagesize? */
|
|
#define HUGETLB_PAGESIZE (2 * 1024 * 1024)
|
|
@@ -49,56 +50,13 @@
|
|
return strlen(dst);
|
|
}
|
|
|
|
-static int plat_get_exe_dir(char *dst, int len)
|
|
+size_t plat_get_skin_dir(char *dst)
|
|
{
|
|
-#ifdef PICO_DATA_DIR
|
|
- memcpy(dst, PICO_DATA_DIR, sizeof PICO_DATA_DIR);
|
|
- return sizeof(PICO_DATA_DIR) - 1;
|
|
-#else
|
|
- int j, ret = readlink("/proc/self/exe", dst, len - 1);
|
|
- if (ret < 0) {
|
|
- perror("readlink");
|
|
- ret = 0;
|
|
- }
|
|
- dst[ret] = 0;
|
|
-
|
|
- for (j = ret - 1; j > 0; j--)
|
|
- if (dst[j] == '/') {
|
|
- dst[++j] = 0;
|
|
- break;
|
|
- }
|
|
- return j;
|
|
-#endif
|
|
-}
|
|
-
|
|
-int plat_get_skin_dir(char *dst, int len)
|
|
-{
|
|
- int ret = plat_get_exe_dir(dst, len);
|
|
- if (ret < 0)
|
|
- return ret;
|
|
-
|
|
- memcpy(dst + ret, "skin/", sizeof "skin/");
|
|
- return ret + sizeof("skin/") - 1;
|
|
-}
|
|
+ static const char path[] = PCSX_DOT_DIR "skin/";
|
|
+ static const size_t len = sizeof path / sizeof path[0];
|
|
|
|
-#ifndef PICO_HOME_DIR
|
|
-#define PICO_HOME_DIR "/.picodrive/"
|
|
-#endif
|
|
-int plat_get_root_dir(char *dst, int len)
|
|
-{
|
|
-#if !defined(NO_HOME_DIR) && !defined(__GP2X__) && !defined(PANDORA)
|
|
- const char *home = getenv("HOME");
|
|
- int ret;
|
|
-
|
|
- if (home != NULL) {
|
|
- ret = snprintf(dst, len, "%s%s", home, PICO_HOME_DIR);
|
|
- if (ret >= len)
|
|
- ret = len - 1;
|
|
- mkdir(dst, 0755);
|
|
- return ret;
|
|
- }
|
|
-#endif
|
|
- return plat_get_exe_dir(dst, len);
|
|
+ memcpy(dst, path, len);
|
|
+ return len - 1;
|
|
}
|
|
|
|
#ifdef __GP2X__
|