Changeset 165 in dev for trunk/abdev/BasicCompiler_Common/NonVolatile.cpp
- Timestamp:
- Jun 17, 2007, 1:45:13 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/NonVolatile.cpp
r4 r165 1 #include <jenga/include/common/Environment.h> 2 1 3 #include "../BasicCompiler_Common/common.h" 2 4 3 5 4 char *ReadBuffer_NonErrMsg( char *path){6 char *ReadBuffer_NonErrMsg( const string &path ){ 5 7 extern HANDLE hHeap; 6 8 int i; … … 9 11 HANDLE hFile; 10 12 11 hFile=CreateFile(path ,GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);13 hFile=CreateFile(path.c_str(),GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL); 12 14 if(hFile==INVALID_HANDLE_VALUE) return 0; 13 15 i=GetFileSize(hFile,0); … … 18 20 return buffer; 19 21 } 20 _int8 WriteBuffer( char *path,char *buffer,int length){22 _int8 WriteBuffer( const string &path, char *buffer,int length){ 21 23 extern HWND hOwnerEditor; 22 24 HANDLE hFile; 23 25 DWORD dw; 24 hFile=CreateFile(path ,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);26 hFile=CreateFile(path.c_str(),GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL); 25 27 if(hFile==INVALID_HANDLE_VALUE){ 26 28 char temporary[MAX_PATH]; … … 101 103 extern HANDLE hHeap; 102 104 int i; 103 char temporary[MAX_PATH];104 105 105 106 //開く 106 extern char BasicSystemDir[MAX_PATH]; 107 sprintf(temporary,"%sUserSetting\\compiler.ini",BasicSystemDir); 108 109 buffer=ReadBuffer_NonErrMsg(temporary); 107 buffer=ReadBuffer_NonErrMsg( Jenga::Common::Environment::GetAppDir() + "\\UserSetting\\compiler.ini" ); 110 108 if(!buffer){ 111 109 //レジストリを読み込む … … 137 135 ppWatchStr=(char **)HeapAlloc(hHeap,0,WatchNum*sizeof(char *)+1); 138 136 for(i=0;i<WatchNum;i++){ 137 char temporary[VN_SIZE]; 139 138 sprintf(temporary,"Watch%03d",i); 140 139 … … 248 247 char temporary[MAX_PATH]; 249 248 250 extern char BasicSystemDir[MAX_PATH]; 251 sprintf(temporary,"%sUserSetting",BasicSystemDir); 249 const string userSettingDirPath = Jenga::Common::Environment::GetAppDir() + "\\UserSetting"; 252 250 253 251 HANDLE hFind; 254 252 WIN32_FIND_DATA wfd; 255 hFind=FindFirstFile( temporary,&wfd);253 hFind=FindFirstFile( userSettingDirPath.c_str() ,&wfd); 256 254 if(hFind==INVALID_HANDLE_VALUE){ 257 255 //UserSettingディレクトリを作成 258 if(!CreateDirectory( temporary,NULL)){256 if(!CreateDirectory( userSettingDirPath.c_str() ,NULL)){ 259 257 extern HWND hOwnerEditor; 260 258 MessageBox(hOwnerEditor,"UserSettingディレクトリの作成に失敗","ActiveBasic",MB_OK|MB_ICONEXCLAMATION); … … 287 285 288 286 //保存 289 extern char BasicSystemDir[MAX_PATH];290 sprintf(temporary,"%sUserSetting\\compiler.ini",BasicSystemDir);291 WriteBuffer(temporary,buffer,lstrlen(buffer));287 WriteBuffer( 288 userSettingDirPath + "\\compiler.ini", 289 buffer,lstrlen(buffer)); 292 290 293 291
Note:
See TracChangeset
for help on using the changeset viewer.