Interpret home also on Linux

This commit is contained in:
Aoran Zeng 2024-07-09 15:03:11 +08:00
parent b7fbde047a
commit f82bfe0cbb

View File

@ -637,15 +637,13 @@ _xy_win_powershellv5_profile ()
static bool static bool
xy_file_exist (const char *path) xy_file_exist (const char *path)
{ {
const char *newpath = path; const char *new_path = path;
if (xy_on_windows)
{
if (xy_str_start_with (path, "~")) if (xy_str_start_with (path, "~"))
{ {
newpath = xy_2strjoin (xy_os_home, path + 1); new_path = xy_2strjoin (xy_os_home, path + 1);
} }
} // 0 即 F_OK
return access (newpath, 0) ? false : true; return (0==access (new_path, 0)) ? true : false;
} }
/** /**