Ignore:
Timestamp:
Jun 17, 2007, 1:45:13 PM (17 years ago)
Author:
dai_9181
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/abdev/BasicCompiler_Common/NonVolatile.cpp

    r4 r165  
     1#include <jenga/include/common/Environment.h>
     2
    13#include "../BasicCompiler_Common/common.h"
    24
    35
    4 char *ReadBuffer_NonErrMsg(char *path){
     6char *ReadBuffer_NonErrMsg( const string &path ){
    57    extern HANDLE hHeap;
    68    int i;
     
    911    HANDLE hFile;
    1012
    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);
    1214    if(hFile==INVALID_HANDLE_VALUE) return 0;
    1315    i=GetFileSize(hFile,0);
     
    1820    return buffer;
    1921}
    20 _int8 WriteBuffer(char *path,char *buffer,int length){
     22_int8 WriteBuffer( const string &path, char *buffer,int length){
    2123    extern HWND hOwnerEditor;
    2224    HANDLE hFile;
    2325    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);
    2527    if(hFile==INVALID_HANDLE_VALUE){
    2628        char temporary[MAX_PATH];
     
    101103    extern HANDLE hHeap;
    102104    int i;
    103     char temporary[MAX_PATH];
    104105
    105106    //開く
    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" );
    110108    if(!buffer){
    111109        //レジストリを読み込む
     
    137135    ppWatchStr=(char **)HeapAlloc(hHeap,0,WatchNum*sizeof(char *)+1);
    138136    for(i=0;i<WatchNum;i++){
     137        char temporary[VN_SIZE];
    139138        sprintf(temporary,"Watch%03d",i);
    140139
     
    248247    char temporary[MAX_PATH];
    249248
    250     extern char BasicSystemDir[MAX_PATH];
    251     sprintf(temporary,"%sUserSetting",BasicSystemDir);
     249    const string userSettingDirPath = Jenga::Common::Environment::GetAppDir() + "\\UserSetting";
    252250
    253251    HANDLE hFind;
    254252    WIN32_FIND_DATA wfd;
    255     hFind=FindFirstFile(temporary,&wfd);
     253    hFind=FindFirstFile( userSettingDirPath.c_str() ,&wfd);
    256254    if(hFind==INVALID_HANDLE_VALUE){
    257255        //UserSettingディレクトリを作成
    258         if(!CreateDirectory(temporary,NULL)){
     256        if(!CreateDirectory( userSettingDirPath.c_str() ,NULL)){
    259257            extern HWND hOwnerEditor;
    260258            MessageBox(hOwnerEditor,"UserSettingディレクトリの作成に失敗","ActiveBasic",MB_OK|MB_ICONEXCLAMATION);
     
    287285
    288286    //保存
    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));
    292290
    293291
Note: See TracChangeset for help on using the changeset viewer.