Develop and Download Open Source Software

Browse Subversion Repository

Diff of /trunk/teraterm/ttpcmn/ttcmn.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 9568 by zmatsuo, Sun Dec 5 13:07:54 2021 UTC revision 9570 by zmatsuo, Sun Dec 5 13:08:19 2021 UTC
# Line 36  Line 36 
36  #include <htmlhelp.h>  #include <htmlhelp.h>
37  #include <assert.h>  #include <assert.h>
38  #include <crtdbg.h>  #include <crtdbg.h>
39    #include <time.h>
40    
41  #define DllExport __declspec(dllexport)  #define DllExport __declspec(dllexport)
42  #include "language.h"  #include "language.h"
# Line 49  Line 50 
50  #include "compat_win.h"  #include "compat_win.h"
51  #include "win32helper.h"  #include "win32helper.h"
52  #include "asprintf.h"  #include "asprintf.h"
53    #include "fileread.h"
54    
55  #include "ttcmn_dup.h"  #include "ttcmn_dup.h"
56    
# Line 163  static void CopyFiles(const wchar_t *fil Line 165  static void CopyFiles(const wchar_t *fil
165          }          }
166  }  }
167    
168    static void ConvertIniFiles(const wchar_t *filelist[],  const wchar_t *dir, const wchar_t *date_str)
169    {
170            while(1) {
171                    if (*filelist == NULL) {
172                            break;
173                    }
174    
175                    wchar_t *fname = NULL;
176                    awcscats(&fname, dir, L"\\", *filelist, NULL);
177                    ConvertIniFileCharCode(fname, date_str);
178                    free(fname);
179                    filelist++;
180            }
181    }
182    
183  BOOL WINAPI StartTeraTerm(PTTSet ts)  BOOL WINAPI StartTeraTerm(PTTSet ts)
184  {  {
185          if (FirstInstance) {          if (FirstInstance) {
# Line 202  BOOL WINAPI StartTeraTerm(PTTSet ts) Line 219  BOOL WINAPI StartTeraTerm(PTTSet ts)
219          awcscats(&ts->KeyCnfFNW, ts->HomeDirW, L"\\KEYBOARD.CNF", NULL);          awcscats(&ts->KeyCnfFNW, ts->HomeDirW, L"\\KEYBOARD.CNF", NULL);
220          WideCharToACP_t(ts->KeyCnfFNW, ts->KeyCnfFN, _countof(ts->KeyCnfFN));          WideCharToACP_t(ts->KeyCnfFNW, ts->KeyCnfFN, _countof(ts->KeyCnfFN));
221    
222          // TERATERM.INI が存在する?          // TERATERM.INI が存在しないとき
223            // 設定ファイルを個人フォルダへコピーする
224          if (GetFileAttributesW(ts->SetupFNameW) == INVALID_FILE_ATTRIBUTES) {          if (GetFileAttributesW(ts->SetupFNameW) == INVALID_FILE_ATTRIBUTES) {
                 // 存在しない場合、設定ファイルを個人フォルダへコピーする  
                 // TODO 設定ファイルの unicode, ansi変換  
225                  static const wchar_t *filelist[] = {                  static const wchar_t *filelist[] = {
226                          L"TERATERM.INI",                          L"TERATERM.INI",
227                          L"KEYBOARD.CNF",                          L"KEYBOARD.CNF",
# Line 228  BOOL WINAPI StartTeraTerm(PTTSet ts) Line 244  BOOL WINAPI StartTeraTerm(PTTSet ts)
244                  CopyFiles(filelist, ts->ExeDirW, ts->HomeDirW);                  CopyFiles(filelist, ts->ExeDirW, ts->HomeDirW);
245          }          }
246    
247            // iniファイルの文字コードを変換する
248            {
249                    static const wchar_t *filelist[] = {
250                            L"TERATERM.INI",
251                            L"KEYBOARD.CNF",
252                            NULL,
253                    };
254    
255                    // backup ファイルにつける日付文字列
256                    time_t now;
257                    time(&now);
258                    struct tm *now_tm;
259                    now_tm = localtime(&now);
260                    wchar_t dete_str[256];
261                    wcsftime(dete_str, _countof(dete_str), L"%y%m%d_%H%M%S_", now_tm);
262    
263                    // iniファイルを変換する
264                    ConvertIniFiles(filelist, ts->HomeDirW, dete_str);
265            }
266    
267          if (FirstInstance) {          if (FirstInstance) {
268                  FirstInstance = FALSE;                  FirstInstance = FALSE;
269                  return TRUE;                  return TRUE;

Legend:
Removed from v.9568  
changed lines
  Added in v.9570

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26