Skip to content

Commit 3ee6ea0

Browse files
author
Mikachu2333
committed
fix os judgement
1 parent 492654c commit 3ee6ea0

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

lib/xy.h

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -800,15 +800,16 @@ _xy_os_home ()
800800
*/
801801
static char *
802802
_xy_win_get_documents_dir() {
803-
#ifdef xy_on_windows
804-
char documents_path[MAX_PATH];
805-
HRESULT result = SHGetFolderPathA(NULL, CSIDL_MYDOCUMENTS, NULL,
806-
SHGFP_TYPE_CURRENT, documents_path);
803+
if (xy_on_windows)
804+
{
805+
char documents_path[MAX_PATH];
806+
HRESULT result = SHGetFolderPathA(NULL, CSIDL_MYDOCUMENTS, NULL,
807+
SHGFP_TYPE_CURRENT, documents_path);
807808

808-
if (SUCCEEDED(result)) {
809-
return xy_strdup(documents_path);
809+
if (SUCCEEDED(result)) {
810+
return xy_strdup(documents_path);
811+
}
810812
}
811-
#endif
812813

813814
return xy_2pathjoin(xy_os_home, "Documents");
814815
}

0 commit comments

Comments
 (0)