[ttssh2-commit] [9501] 設定ファイルを置くフォルダを変更

Back to archive index
scmno****@osdn***** scmno****@osdn*****
2021年 10月 27日 (水) 21:48:49 JST


Revision: 9501
          https://osdn.net/projects/ttssh2/scm/svn/commits/9501
Author:   zmatsuo
Date:     2021-10-27 21:48:49 +0900 (Wed, 27 Oct 2021)
Log Message:
-----------
設定ファイルを置くフォルダを変更

- フォルダ
  - %APPDATA%\teraterm5 (%USERPROFILE%\AppData\Roaming\teraterm5)
- ファイル
  - TERATERM.INI
  - KEYBOARD.CFG
  - broadcast.log
- 使用していない GetDefaultFName() を削除
  - GetDefaultFNameW() に置き換えた
- フォルダに関する関数を整理
  - GetHomeDirW() を修正
    - 設定ファイルを置くフォルダを返す
    - ttypes.HomeDirW と同一
	- 従来は ttermpro.exe などが置いてあるフォルダを返していた
  - GetLogDirW() を追加
    - ログなどを置くフォルダを返す
    - ttypes.LogDirW と同一
  - GetExeDirW() を追加
    - ttermpro.exe などが存在するフォルダを返す
    - ttypes.LogDirW と同一

Modified Paths:
--------------
    trunk/teraterm/common/ttlib.c
    trunk/teraterm/common/ttlib.h
    trunk/teraterm/common/ttlib_charset.cpp
    trunk/teraterm/common/ttlib_static_cpp.cpp
    trunk/teraterm/teraterm/broadcast.cpp
    trunk/teraterm/teraterm/ttplug.c
    trunk/teraterm/teraterm/ttwinman.c
    trunk/teraterm/ttpcmn/ttcmn.c
    trunk/teraterm/ttpcmn/ttpcmn.def
    trunk/teraterm/ttpdlg/ttdlg.c
    trunk/teraterm/ttpset/ttset.c
    trunk/ttssh2/ttxssh/ttxssh.c

-------------- next part --------------
Modified: trunk/teraterm/common/ttlib.c
===================================================================
--- trunk/teraterm/common/ttlib.c	2021-10-24 15:36:38 UTC (rev 9500)
+++ trunk/teraterm/common/ttlib.c	2021-10-27 12:48:49 UTC (rev 9501)
@@ -828,17 +828,6 @@
 	free(download);
 }
 
-void GetDefaultFName(const char *home, const char *file, char *dest, int destlen)
-{
-	wchar_t *homeW = ToWcharA(home);
-	wchar_t *fileW = ToWcharA(file);
-	wchar_t *destW = GetDefaultFNameW(homeW, fileW);
-	WideCharToACP_t(destW, dest, destlen);
-	free(destW);
-	free(fileW);
-	free(homeW);
-}
-
 /*
  *	UILanguageFile\x82̃t\x83\x8B\x83p\x83X\x82\xF0\x8E擾\x82\xB7\x82\xE9
  *

Modified: trunk/teraterm/common/ttlib.h
===================================================================
--- trunk/teraterm/common/ttlib.h	2021-10-24 15:36:38 UTC (rev 9500)
+++ trunk/teraterm/common/ttlib.h	2021-10-27 12:48:49 UTC (rev 9501)
@@ -90,7 +90,8 @@
 void GetDownloadFolder(char *dest, int destlen);
 wchar_t *GetDownloadFolderW(void);
 wchar_t *GetHomeDirW(HINSTANCE hInst);
-void GetDefaultFName(const char *home, const char *file, char *dest, int destlen);
+wchar_t *GetExeDirW(HINSTANCE hInst);
+wchar_t* GetLogDirW(void);
 wchar_t *GetDefaultFNameW(const wchar_t *home, const wchar_t *file);
 wchar_t *GetDefaultSetupFNameW(const wchar_t *home);
 void GetUILanguageFileFull(const char *HomeDir, const char *UILanguageFileRel,

Modified: trunk/teraterm/common/ttlib_charset.cpp
===================================================================
--- trunk/teraterm/common/ttlib_charset.cpp	2021-10-24 15:36:38 UTC (rev 9500)
+++ trunk/teraterm/common/ttlib_charset.cpp	2021-10-27 12:48:49 UTC (rev 9501)
@@ -128,6 +128,10 @@
  */
 int GetKanjiCodeFromStr(int language, const char *kanji_code_str)
 {
+	if (kanji_code_str[0] == 0) {
+		return IdUTF8;
+	}
+
 	for (int i = 0; i < sizeof(KanjiList); i++) {
 		if (KanjiList[i].lang == language &&
 			strcmp(KanjiList[i].KanjiCode, kanji_code_str) == 0) {

Modified: trunk/teraterm/common/ttlib_static_cpp.cpp
===================================================================
--- trunk/teraterm/common/ttlib_static_cpp.cpp	2021-10-24 15:36:38 UTC (rev 9500)
+++ trunk/teraterm/common/ttlib_static_cpp.cpp	2021-10-27 12:48:49 UTC (rev 9501)
@@ -805,7 +805,7 @@
 }
 
 /**
- *	Hwx2Str() \x82\xCC wchar_t \x94\xC5
+ *	Hex2Str() \x82\xCC wchar_t \x94\xC5
  */
 int Hex2StrW(const wchar_t *Hex, wchar_t *Str, size_t MaxLen)
 {
@@ -878,20 +878,22 @@
 }
 
 /*
- * Get home(exe,dll) directory
+ * Get Exe(exe,dll) directory
+ *	ttermpro.exe, \x83v\x83\x89\x83O\x83C\x83\x93\x82\xAA\x82\xA0\x82\xE9\x83t\x83H\x83\x8B\x83_
+ *	ttypes.ExeDirW \x82Ɠ\xAF\x88\xEA
+ *	\x82\xE0\x82Ƃ\xCD GetHomeDirW() \x82\xBE\x82\xC1\x82\xBD
  *
  * @param[in]		hInst		WinMain()\x82\xCC HINSTANCE \x82܂\xBD\x82\xCD NULL
- * @return			HomeDir
+ * @return			ExeDir		\x95s\x97v\x82ɂȂ\xC1\x82\xBD\x82\xE7 free() \x82\xB7\x82邱\x82\xC6
  */
-wchar_t *GetHomeDirW(HINSTANCE hInst)
+wchar_t *GetExeDirW(HINSTANCE hInst)
 {
 	wchar_t *TempW;
 	wchar_t *dir;
-	DWORD error = hGetModuleFileNameW(NULL, &TempW);
-	if (error != 0) {
+	DWORD error = hGetModuleFileNameW(hInst, &TempW);
+	if (error != NO_ERROR) {
 		// \x83p\x83X\x82̎擾\x82Ɏ\xB8\x94s\x82\xB5\x82\xBD\x81B\x92v\x96\xBD\x93I\x81Aabort() \x82\xB7\x82\xE9\x81B
 		abort();
-		// \x82\xB1\x82\xB1\x82\xC5return\x82\xB5\x82Ă\xE0\x83v\x83\x89\x83O\x83C\x83\x93(ttpset.dll)\x82̃\x8D\x81[\x83h\x82Ɏ\xB8\x94s\x82\xB5\x82\xC4abort()\x82\xB7\x82\xE9
 	}
 	dir = ExtractDirNameW(TempW);
 	free(TempW);
@@ -899,9 +901,49 @@
 }
 
 /*
+ * Get home directory
+ *		\x8Cl\x97p\x90ݒ\xE8\x83t\x83@\x83C\x83\x8B\x83t\x83H\x83\x8B\x83_\x8E擾
+ *		ttypes.HomeDirW \x82Ɠ\xAF\x88\xEA
+ *		TERATERM.INI \x82Ȃǂ\xAA\x82\xA8\x82\xA2\x82Ă\xA0\x82\xE9\x83t\x83H\x83\x8B\x83_
+ *		ttermpro.exe \x82\xAA\x82\xA0\x82\xE9\x83t\x83H\x83\x8B\x83_\x82\xCD GetExeDirW() \x82Ŏ擾
+ *		%APPDATA%\teraterm5 (%USERPROFILE%\AppData\Roaming\teraterm5)
+ *
+ * @param[in]		hInst		WinMain()\x82\xCC HINSTANCE \x82܂\xBD\x82\xCD NULL
+ * @return			HomeDir		\x95s\x97v\x82ɂȂ\xC1\x82\xBD\x82\xE7 free() \x82\xB7\x82邱\x82\xC6
+ */
+wchar_t *GetHomeDirW(HINSTANCE hInst)
+{
+	wchar_t *path;
+	_SHGetKnownFolderPath(FOLDERID_RoamingAppData, 0, NULL, &path);
+	wchar_t *ret = NULL;
+	awcscats(&ret, path, L"\\teraterm5", NULL);
+	free(path);
+	return ret;
+}
+
+/*
+ * Get log directory
+ *		\x83\x8D\x83O\x95ۑ\xB6\x83t\x83H\x83\x8B\x83_\x8E擾
+ *		ttypes.LogDirW \x82Ɠ\xAF\x88\xEA
+ *		%LOCALAPPDATA%\teraterm5 (%USERPROFILE%\AppData\Local\teraterm5)
+ *
+ * @param[in]		hInst		WinMain()\x82\xCC HINSTANCE \x82܂\xBD\x82\xCD NULL
+ * @return			LogDir		\x95s\x97v\x82ɂȂ\xC1\x82\xBD\x82\xE7 free() \x82\xB7\x82邱\x82\xC6
+ */
+wchar_t* GetLogDirW(void)
+{
+	wchar_t *path;
+	_SHGetKnownFolderPath(FOLDERID_LocalAppData, 0, NULL, &path);
+	wchar_t *ret = NULL;
+	awcscats(&ret, path, L"\\teraterm5", NULL);
+	free(path);
+	return ret;
+}
+
+/*
  *	UILanguageFile\x82̃t\x83\x8B\x83p\x83X\x82\xF0\x8E擾\x82\xB7\x82\xE9
  *
- *	@param[in]		HomeDir					exe,dll\x82̑\xB6\x8D݂\xB7\x82\xE9\x83t\x83H\x83\x8B\x83_ GetHomeDir()\x82Ŏ擾\x82ł\xAB\x82\xE9
+ *	@param[in]		HomeDir					exe,dll\x82̑\xB6\x8D݂\xB7\x82\xE9\x83t\x83H\x83\x8B\x83_ GetExeDir()\x82Ŏ擾\x82ł\xAB\x82\xE9
  *	@param[in]		UILanguageFileRel		lng\x83t\x83@\x83C\x83\x8B\x81AHomeDir\x82\xA9\x82\xE7\x82̑\x8A\x91΃p\x83X
  *	@param[in,out]	UILanguageFileFull		lng\x83t\x83@\x83C\x83\x8Bptr\x81A\x83t\x83\x8B\x83p\x83X
  *	@param[in]		UILanguageFileFullLen	lng\x83t\x83@\x83C\x83\x8Blen\x81A\x83t\x83\x8B\x83p\x83X

Modified: trunk/teraterm/teraterm/broadcast.cpp
===================================================================
--- trunk/teraterm/teraterm/broadcast.cpp	2021-10-24 15:36:38 UTC (rev 9500)
+++ trunk/teraterm/teraterm/broadcast.cpp	2021-10-27 12:48:49 UTC (rev 9501)
@@ -32,6 +32,8 @@
 #include "tttypes.h"
 #include "ttcommon.h"
 #include "ttwinman.h"
+#include "compat_win.h"
+#include "asprintf.h"
 
 #include <stdio.h>
 #define _CRTDBG_MAP_ALLOC
@@ -89,6 +91,32 @@
 
 #define BROADCAST_LOGFILE L"broadcast.log"
 
+/**
+ *	\x97\x9A\x97\xF0\x82\xF0\x95ۑ\xB6\x82\xB7\x82\xE9\x83t\x83@\x83C\x83\x8B\x96\xBC(\x83t\x83\x8B\x83p\x83X)\x82\xF0\x8E擾
+ *	@return	\x83t\x83@\x83C\x83\x8B\x96\xBC
+ *			\x95s\x97v\x82ɂȂ\xC1\x82\xBD\x82\xE7 free() \x82\xB7\x82邱\x82\xC6
+ */
+static wchar_t *GetHistoryFileName(TTTSet *ts_)
+{
+	wchar_t *fname;
+
+	// My Documents \x82\xC9 file \x82\xAA\x91\xB6\x8D݂\xB7\x82\xE9\x8Fꍇ\x81A\x82\xBB\x82\xEA\x82\xF0\x97D\x90悵\x82Ďg\x97p\x82\xB7\x82\xE9
+	// TODO \x82\xB1\x82̓\xAE\x8D\xEC\x82͍폜\x82\xB5\x82\xBD\x82ق\xA4\x82\xAA\x82悳\x82\xBB\x82\xA4
+#if 1
+	HRESULT hr = _SHGetKnownFolderPath(FOLDERID_Documents, 0, NULL, &fname);
+	awcscats(&fname, L"\\", BROADCAST_LOGFILE, NULL);
+	DWORD r = GetFileAttributesW(fname);
+	if (r != INVALID_FILE_ATTRIBUTES) {
+		return fname;
+	}
+	free(fname);
+#endif
+
+	fname = NULL;
+	awcscats(&fname, ts_->HomeDirW, L"\\", BROADCAST_LOGFILE, NULL);
+	return fname;
+}
+
 static void ApplyBroadCastCommandHisotry(HWND Dialog, wchar_t *historyfile)
 {
 	wchar_t EntName[13];
@@ -199,7 +227,7 @@
 				const wchar_t *lpstr = GetConvStringW(dlg, lParam, &len);
 				if (lpstr != NULL) {
 					char32_t *strU32 = ToU32W(lpstr);
-					int count = SendMessage(BroadcastWindowList, LB_GETCOUNT, 0, 0);
+					int count = (int)SendMessage(BroadcastWindowList, LB_GETCOUNT, 0, 0);
 					for (int i = 0 ; i < count ; i++) {
 						if (SendMessage(BroadcastWindowList, LB_GETSEL, i, 0)) {
 							HWND hwnd = GetNthWin(i);
@@ -451,7 +479,7 @@
 			if (ts.BroadcastCommandHistory) {
 				SendMessage(GetDlgItem(hWnd, IDC_HISTORY_CHECK), BM_SETCHECK, BST_CHECKED, 0);
 			}
-			wchar_t *historyfile = GetDefaultFNameW(ts.HomeDirW, BROADCAST_LOGFILE);
+			wchar_t *historyfile = GetHistoryFileName(&ts);
 			ApplyBroadCastCommandHisotry(hWnd, historyfile);
 			free(historyfile);
 
@@ -584,7 +612,7 @@
 							// \x83u\x83\x8D\x81[\x83h\x83L\x83\x83\x83X\x83g\x83R\x83}\x83\x93\x83h\x82̗\x9A\x97\xF0\x82\xF0\x95ۑ\xB6 (2007.3.3 maya)
 							history = SendMessage(GetDlgItem(hWnd, IDC_HISTORY_CHECK), BM_GETCHECK, 0, 0);
 							if (history) {
-								wchar_t *historyfile = GetDefaultFNameW(ts.HomeDirW, BROADCAST_LOGFILE);
+								wchar_t *historyfile = GetHistoryFileName(&ts);
 								if (LoadTTSET()) {
 									(*AddValueToList)(historyfile, buf, L"BroadcastCommands", L"Command",
 													  ts.MaxBroadcatHistory);
@@ -638,7 +666,7 @@
 
 				case IDC_COMMAND_EDIT:
 					if (HIWORD(wp) == CBN_DROPDOWN) {
-						wchar_t *historyfile = GetDefaultFNameW(ts.HomeDirW, BROADCAST_LOGFILE);
+						wchar_t *historyfile = GetHistoryFileName(&ts);
 						ApplyBroadCastCommandHisotry(hWnd, historyfile);
 						free(historyfile);
 					}

Modified: trunk/teraterm/teraterm/ttplug.c
===================================================================
--- trunk/teraterm/teraterm/ttplug.c	2021-10-24 15:36:38 UTC (rev 9500)
+++ trunk/teraterm/teraterm/ttplug.c	2021-10-27 12:48:49 UTC (rev 9501)
@@ -146,15 +146,15 @@
 	wchar_t *load_mask;
 	WIN32_FIND_DATAW fd;
 	HANDLE hFind;
-	wchar_t *HomeDirW = ts_->HomeDirW;
+	wchar_t *ExeDirW = ts_->ExeDirW;
 
-	aswprintf(&load_mask, L"%s\\TTX*.DLL", HomeDirW);
+	aswprintf(&load_mask, L"%s\\TTX*.DLL", ExeDirW);
 
 	hFind = FindFirstFileW(load_mask, &fd);
 	if (hFind != INVALID_HANDLE_VALUE) {
 		do {
 			wchar_t *filename;
-			aswprintf(&filename, L"%s\\%s", HomeDirW, fd.cFileName);
+			aswprintf(&filename, L"%s\\%s", ExeDirW, fd.cFileName);
 			loadExtension(filename, ts_->UILanguageFileW);
 			free(filename);
 		} while (FindNextFileW(hFind, &fd));

Modified: trunk/teraterm/teraterm/ttwinman.c
===================================================================
--- trunk/teraterm/teraterm/ttwinman.c	2021-10-24 15:36:38 UTC (rev 9500)
+++ trunk/teraterm/teraterm/ttwinman.c	2021-10-27 12:48:49 UTC (rev 9501)
@@ -257,7 +257,7 @@
 {
 	HMODULE handle;
 	wchar_t *DLLpath;
-	aswprintf(&DLLpath, L"%s\\%s", ts.HomeDirW, DLLname);
+	aswprintf(&DLLpath, L"%s\\%s", ts.ExeDirW, DLLname);
 	handle = LoadLibraryW(DLLpath);
 	free(DLLpath);
 	return handle;

Modified: trunk/teraterm/ttpcmn/ttcmn.c
===================================================================
--- trunk/teraterm/ttpcmn/ttcmn.c	2021-10-24 15:36:38 UTC (rev 9500)
+++ trunk/teraterm/ttpcmn/ttcmn.c	2021-10-27 12:48:49 UTC (rev 9501)
@@ -109,17 +109,6 @@
 	memcpy(&pm->ts, ts, sizeof(TTTSet));
 }
 
-static wchar_t* GetLogDirW()
-{
-	wchar_t *local_app_data;
-	wchar_t *log;
-	_SHGetKnownFolderPath(&FOLDERID_LocalAppData, 0, NULL, &local_app_data);
-	aswprintf(&log, L"%s\\%s", local_app_data, L"teraterm5");
-	free(local_app_data);
-	CreateDirectoryW(log, NULL);
-	return log;
-}
-
 BOOL WINAPI StartTeraTerm(PTTSet ts)
 {
 	if (FirstInstance) {
@@ -139,16 +128,60 @@
 	// if (FirstInstance) { \x82̕\x94\x95\xAA\x82\xA9\x82\xE7\x88ړ\xAE (2008.3.13 maya)
 	// \x8BN\x93\xAE\x8E\x9E\x82ɂ́A\x8B\xA4\x97L\x83\x81\x83\x82\x83\x8A\x82\xCC HomeDir \x82\xC6 SetupFName \x82͋\xF3\x82ɂȂ\xE9
 	/* Get home directory (ttermpro.exe\x82̃t\x83H\x83\x8B\x83_) */
-	ts->ExeDirW = GetHomeDirW(hInst);
+	ts->ExeDirW = GetExeDirW(hInst);
+
+	// LogDir
 	ts->LogDirW = GetLogDirW();
+	CreateDirectoryW(ts->LogDirW, NULL);
+
+	// HomeDir
 	ts->HomeDirW = GetHomeDirW(hInst);
 	WideCharToACP_t(ts->HomeDirW, ts->HomeDir, _countof(ts->HomeDir));
-	SetCurrentDirectoryW(ts->HomeDirW);
+	CreateDirectoryW(ts->HomeDirW, NULL);
+	SetCurrentDirectoryW(ts->HomeDirW);		// TODO \x95K\x97v??
 
+#if 1
+	{
+		// TERATERM.INI \x82̃t\x83\x8B\x83p\x83X
+		wchar_t *setup = NULL;
+		awcscats(&setup, ts->HomeDirW, L"\\TERATERM.INI", NULL);
+
+		// \x83t\x83@\x83C\x83\x8B\x82\xA0\x82\xE9?
+		if (GetFileAttributesW(setup) == INVALID_FILE_ATTRIBUTES) {
+			// exe\x83t\x83H\x83\x8B\x83_\x82\xA9\x82\xE7\x83R\x83s\x81[\x82\xB7\x82\xE9
+			wchar_t *src_ini = NULL;
+			awcscats(&src_ini, ts->ExeDirW, L"\\TERATERM.INI", NULL);
+			CopyFileW(src_ini, setup, TRUE);
+			free(src_ini);
+		}
+
+		ts->SetupFNameW = setup;
+	}
+#else
 	ts->SetupFNameW = GetDefaultSetupFNameW(ts->HomeDirW);
+#endif
 	WideCharToACP_t(ts->SetupFNameW, ts->SetupFName, _countof(ts->SetupFName));
 
+#if 1
+	{
+		// KEYBOARD.CNF \x82̃t\x83\x8B\x83p\x83X
+		wchar_t *keycnf = NULL;
+		awcscats(&keycnf, ts->HomeDirW, L"\\KEYBOARD.CNF", NULL);
+
+		// \x83t\x83@\x83C\x83\x8B\x82\xA0\x82\xE9?
+		if (GetFileAttributesW(keycnf) == INVALID_FILE_ATTRIBUTES) {
+			// exe\x83t\x83H\x83\x8B\x83_\x82\xA9\x82\xE7\x83R\x83s\x81[\x82\xB7\x82\xE9
+			wchar_t *src_ini = NULL;
+			awcscats(&src_ini, ts->ExeDirW, L"\\KEYBOARD.CNF", NULL);
+			CopyFileW(src_ini, keycnf, TRUE);
+			free(src_ini);
+		}
+
+		ts->KeyCnfFNW = keycnf;
+	}
+#else
 	ts->KeyCnfFNW = GetDefaultFNameW(ts->HomeDirW, L"KEYBOARD.CNF");
+#endif
 	WideCharToACP_t(ts->KeyCnfFNW, ts->KeyCnfFN, _countof(ts->KeyCnfFN));
 
 	if (FirstInstance) {

Modified: trunk/teraterm/ttpcmn/ttpcmn.def
===================================================================
--- trunk/teraterm/ttpcmn/ttpcmn.def	2021-10-24 15:36:38 UTC (rev 9500)
+++ trunk/teraterm/ttpcmn/ttpcmn.def	2021-10-27 12:48:49 UTC (rev 9501)
@@ -22,7 +22,6 @@
   CommBinaryEcho @26
   CommTextEchoW
   DetectComPorts @42
-  GetDefaultFName @47
   ExtractFileName @48
   replaceInvalidFileNameChar @74
   b64encode @75

Modified: trunk/teraterm/ttpdlg/ttdlg.c
===================================================================
--- trunk/teraterm/ttpdlg/ttdlg.c	2021-10-24 15:36:38 UTC (rev 9500)
+++ trunk/teraterm/ttpdlg/ttdlg.c	2021-10-27 12:48:49 UTC (rev 9501)
@@ -2838,7 +2838,7 @@
 	}
 }
 
-static int make_sel_lang_ui(const wchar_t *HomeDir)
+static int make_sel_lang_ui(const wchar_t *dir)
 {
 	int    i;
 	int    file_num;
@@ -2848,7 +2848,7 @@
 
 	free_lang_ui_list();
 
-	aswprintf(&fullpath, L"%s\\%s\\*%s", HomeDir, get_lang_folder(), LANG_EXT);
+	aswprintf(&fullpath, L"%s\\%s\\*%s", dir, get_lang_folder(), LANG_EXT);
 
 	file_num = 0;
 	hFind = FindFirstFileW(fullpath, &fd);
@@ -2961,7 +2961,7 @@
 			}
 
 			// \x8Dŏ\x89\x82Ɏw\x92肳\x82\xEA\x82Ă\xA2\x82錾\x8C\xEA\x83t\x83@\x83C\x83\x8B\x82̔ԍ\x86\x82\xF0\x8Ao\x82\xA6\x82Ă\xA8\x82\xAD\x81B
-			uilist_count = make_sel_lang_ui(ts->HomeDirW);
+			uilist_count = make_sel_lang_ui(ts->ExeDirW);
 			langui_sel = get_sel_lang_ui(LangUIList, ts->UILanguageFileW_ini);
 			if (LangUIList[0] != NULL) {
 				int i = 0;
@@ -3015,7 +3015,7 @@
 							aswprintf(&ts->UILanguageFileW_ini, L"%s\\%s", get_lang_folder(), LangUIList[w - 1]);
 							WideCharToACP_t(ts->UILanguageFileW_ini, ts->UILanguageFile_ini, sizeof(ts->UILanguageFile_ini));
 
-							ts->UILanguageFileW = GetUILanguageFileFullW(ts->HomeDirW, ts->UILanguageFileW_ini);
+							ts->UILanguageFileW = GetUILanguageFileFullW(ts->ExeDirW, ts->UILanguageFileW_ini);
 							WideCharToACP_t(ts->UILanguageFileW, ts->UILanguageFile, sizeof(ts->UILanguageFile));
 
 							// \x83^\x83C\x83g\x83\x8B\x82̍X\x90V\x82\xF0\x8Ds\x82\xA4\x81B(2014.2.23 yutaka)

Modified: trunk/teraterm/ttpset/ttset.c
===================================================================
--- trunk/teraterm/ttpset/ttset.c	2021-10-24 15:36:38 UTC (rev 9500)
+++ trunk/teraterm/ttpset/ttset.c	2021-10-27 12:48:49 UTC (rev 9501)
@@ -1730,7 +1730,7 @@
 	WideCharToACP_t(ts->UILanguageFileW_ini, ts->UILanguageFile_ini, sizeof(ts->UILanguageFile_ini));
 
 	// UI language message file (full path)
-	ts->UILanguageFileW = GetUILanguageFileFullW(ts->HomeDirW, ts->UILanguageFileW_ini);
+	ts->UILanguageFileW = GetUILanguageFileFullW(ts->ExeDirW, ts->UILanguageFileW_ini);
 	WideCharToACP_t(ts->UILanguageFileW, ts->UILanguageFile, sizeof(ts->UILanguageFile));
 
 

Modified: trunk/ttssh2/ttxssh/ttxssh.c
===================================================================
--- trunk/ttssh2/ttxssh/ttxssh.c	2021-10-24 15:36:38 UTC (rev 9500)
+++ trunk/ttssh2/ttxssh/ttxssh.c	2021-10-27 12:48:49 UTC (rev 9501)
@@ -2461,8 +2461,9 @@
 	}
 
 	// ttermpro.exe\x82̃p\x83X
-	path = GetHomeDirW(NULL);
+	path = GetExeDirW(NULL);
 	aswprintf(&ret, L"%s\\%s", path, basename);
+	free(path);
 	return ret;
 }
 


ttssh2-commit メーリングリストの案内
Back to archive index