重命名为 XY_Build_On_xx

This commit is contained in:
Aoran Zeng 2025-08-20 22:05:07 +08:00
parent 9d7543b681
commit e6d512eb83
No known key found for this signature in database
GPG Key ID: 8F8BA8488E10ED98
5 changed files with 20 additions and 13 deletions

View File

@ -70,7 +70,7 @@ if (!matched) matched = iterate_menu (chsrc_wr_menu, input, &target_tmp);
```c ```c
#ifdef _WIN32 #ifdef _WIN32
#define XY_On_Windows 1 #define XY_Build_On_Windows 1
#define xy_on_windows true #define xy_on_windows true
#ifdef XY_DEBUG #ifdef XY_DEBUG
#define xy_debug_mode 1 #define xy_debug_mode 1

View File

@ -62,7 +62,8 @@ bool xy_enable_color = true;
// #define NDEBUG // #define NDEBUG
#ifdef _WIN32 #ifdef _WIN32
#define XY_On_Windows 1 #define XY_Build_On_Windows 1
#define xy_on_windows true #define xy_on_windows true
#define xy_on_linux false #define xy_on_linux false
#define xy_on_macos false #define xy_on_macos false
@ -73,7 +74,9 @@ bool xy_enable_color = true;
#define xy_use_utf8() SetConsoleOutputCP (65001) #define xy_use_utf8() SetConsoleOutputCP (65001)
#elif defined(__linux__) || defined(__linux) #elif defined(__linux__) || defined(__linux)
#define XY_On_Linux 1 #define XY_Build_On_Linux 1
#define XY_Build_On_Unix 1
#define xy_on_windows false #define xy_on_windows false
#define xy_on_linux true #define xy_on_linux true
#define xy_on_macos false #define xy_on_macos false
@ -82,7 +85,9 @@ bool xy_enable_color = true;
#define xy_use_utf8() #define xy_use_utf8()
#elif defined(__APPLE__) #elif defined(__APPLE__)
#define XY_On_macOS 1 #define XY_Build_On_macOS 1
#define XY_Build_On_Unix 1
#define xy_on_windows false #define xy_on_windows false
#define xy_on_linux false #define xy_on_linux false
#define xy_on_macos true #define xy_on_macos true
@ -91,7 +96,9 @@ bool xy_enable_color = true;
#define xy_use_utf8() #define xy_use_utf8()
#elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__) #elif defined(__OpenBSD__) || defined(__NetBSD__) || defined(__FreeBSD__)
#define XY_On_BSD 1 #define XY_Build_On_BSD 1
#define XY_Build_On_Unix 1
#define xy_on_windows false #define xy_on_windows false
#define xy_on_linux false #define xy_on_linux false
#define xy_on_macos false #define xy_on_macos false
@ -916,7 +923,7 @@ _xy_os_home ()
static char * static char *
_xy_win_documents () _xy_win_documents ()
{ {
#ifdef XY_On_Windows #ifdef XY_Build_On_Windows
char documents_path[MAX_PATH]; char documents_path[MAX_PATH];
HRESULT result = SHGetFolderPathA (NULL, CSIDL_MYDOCUMENTS, NULL, HRESULT result = SHGetFolderPathA (NULL, CSIDL_MYDOCUMENTS, NULL,
SHGFP_TYPE_CURRENT, documents_path); SHGFP_TYPE_CURRENT, documents_path);
@ -1009,7 +1016,7 @@ xy_dir_exist (const char *path)
if (xy_on_windows) if (xy_on_windows)
{ {
#ifdef XY_On_Windows #ifdef XY_Build_On_Windows
// 也可以用 opendir() #include <dirent.h> // 也可以用 opendir() #include <dirent.h>
DWORD attr = GetFileAttributesA (dir); DWORD attr = GetFileAttributesA (dir);

View File

@ -1338,7 +1338,7 @@ chsrc_run_as_a_service (const char *cmd)
FILE * FILE *
chsrc_make_tmpfile (char *filename, char *postfix, bool loud, char **tmpfilename) chsrc_make_tmpfile (char *filename, char *postfix, bool loud, char **tmpfilename)
{ {
#ifdef XY_On_Windows #ifdef XY_Build_On_Windows
/** /**
* Windows mkstemps() mkstemp() _mktemp_s() * Windows mkstemps() mkstemp() _mktemp_s()
* postfix * postfix
@ -1489,7 +1489,7 @@ chsrc_view_env (const char *var1, ...)
bool first = true; bool first = true;
while (var) while (var)
{ {
#ifdef XY_On_Windows #ifdef XY_Build_On_Windows
if (first) if (first)
{ {
cmd = xy_strcat (3, "set ", var, " "); cmd = xy_strcat (3, "set ", var, " ");
@ -1757,7 +1757,7 @@ chsrc_get_cpuarch ()
char *ret; char *ret;
char *msg; char *msg;
#if XY_On_Windows #if XY_Build_On_Windows
SYSTEM_INFO info; SYSTEM_INFO info;
GetSystemInfo (&info); GetSystemInfo (&info);
WORD num = info.wProcessorArchitecture; WORD num = info.wProcessorArchitecture;
@ -1810,7 +1810,7 @@ chsrc_get_cpucore ()
{ {
int cores = 2; int cores = 2;
#if XY_On_Windows #if XY_Build_On_Windows
SYSTEM_INFO info; SYSTEM_INFO info;
GetSystemInfo (&info); GetSystemInfo (&info);
DWORD num = info.dwNumberOfProcessors; DWORD num = info.dwNumberOfProcessors;

View File

@ -125,7 +125,7 @@ pl_python_uv_setsrc (char *option)
const char *source_content = xy_str_gsub (RAWSTR_pl_python_uv_config_source_content, "@url@", source.url); const char *source_content = xy_str_gsub (RAWSTR_pl_python_uv_config_source_content, "@url@", source.url);
#if defined(XY_On_macOS) || defined(XY_On_BSD) #if defined(XY_Build_On_macOS) || defined(XY_Build_On_BSD)
char *sed_cmd = "sed -i '' "; char *sed_cmd = "sed -i '' ";
#else #else
char *sed_cmd = "sed -i "; char *sed_cmd = "sed -i ";

View File

@ -62,7 +62,7 @@ pl_rust_rustup_setsrc (char *option)
{ {
use_this_source(pl_rust_rustup); use_this_source(pl_rust_rustup);
#ifdef XY_On_Windows #ifdef XY_Build_On_Windows
char *cmd1 = xy_strcat (3, "setx RUSTUP_DIST_SERVER \"", source.url, "\""); char *cmd1 = xy_strcat (3, "setx RUSTUP_DIST_SERVER \"", source.url, "\"");
char *cmd2 = xy_strcat (3, "setx RUSTUP_UPDATE_ROOT \"", source.url, "/rustup\""); char *cmd2 = xy_strcat (3, "setx RUSTUP_UPDATE_ROOT \"", source.url, "/rustup\"");