Revision: 9669 https://osdn.net/projects/ttssh2/scm/svn/commits/9669 Author: zmatsuo Date: 2022-01-04 00:17:55 +0900 (Tue, 04 Jan 2022) Log Message: ----------- 設定ファイルのあるフォルダの取得にAPIを使用するよう修正 - SHGetKnownFolderPath(FOLDERID_RoamingAppData) - 変更前は APPDATA 環境変数から取得していた Modified Paths: -------------- trunk/cygwin/cygterm/CMakeLists.txt trunk/cygwin/cygterm/cygterm.cc -------------- next part -------------- Modified: trunk/cygwin/cygterm/CMakeLists.txt =================================================================== --- trunk/cygwin/cygterm/CMakeLists.txt 2022-01-03 15:17:45 UTC (rev 9668) +++ trunk/cygwin/cygterm/CMakeLists.txt 2022-01-03 15:17:55 UTC (rev 9669) @@ -50,6 +50,13 @@ -mwindows ) +target_link_libraries( + ${PACKAGE_NAME} + PRIVATE + shell32 + ole32 + ) + install( TARGETS ${PACKAGE_NAME} DESTINATION . Modified: trunk/cygwin/cygterm/cygterm.cc =================================================================== --- trunk/cygwin/cygterm/cygterm.cc 2022-01-03 15:17:45 UTC (rev 9668) +++ trunk/cygwin/cygterm/cygterm.cc 2022-01-03 15:17:55 UTC (rev 9669) @@ -51,12 +51,15 @@ #include <sys/un.h> #include <sys/wait.h> #include <arpa/inet.h> -#include <windows.h> -#include <shlobj.h> #include <pwd.h> #include <sys/select.h> #include <wchar.h> +#include <windows.h> +#include <shlobj.h> +#define INITGUID +#include <knownfolders.h> + // pageant support (ssh-agent proxy) //---------------------------------- #define AGENT_COPYDATA_ID 0x804e50ba @@ -322,8 +325,6 @@ // $APPDATA char *get_appdata_dir() { -#if 0 - // link error :-( wchar_t *home_pathW; SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &home_pathW); convert_bsW(home_pathW); @@ -330,12 +331,6 @@ char *home_pathU8 = convert_utf8_from_wchar(home_pathW); CoTaskMemFree(home_pathW); return home_pathU8; -#endif -#if 1 - char *appdata = strdup(getenv("APPDATA")); - convert_bs(appdata); - return appdata; -#endif } void get_cfg_filenames(char **cfg_exe_full, char **cfg_appdata_full, char **cfg)