source: dev/trunk/ab5.0/abdev/abdev/FileOperation.cpp @ 651

Last change on this file since 651 was 651, checked in by dai_9181, 15 years ago

・BreakPoint周りをリファクタリング
・FileTree周りをリファクタリング

File size: 15.8 KB
Line 
1#include "stdafx.h"
2
3#include "Common.h"
4
5void MakeUserSettingDir(void){
6    char temporary[MAX_PATH];
7    sprintf(temporary,"%sUserSetting",pj_editor_Dir);
8
9    HANDLE hFind;
10    WIN32_FIND_DATA wfd;
11    hFind=FindFirstFile(temporary,&wfd);
12    if(hFind==INVALID_HANDLE_VALUE){
13        //UserSettingディレクトリを作成
14        if(!CreateDirectory(temporary,NULL)){
15            MessageBox(hOwner,"UserSettingディレクトリの作成に失敗",APPLICATION_NAME,MB_OK|MB_ICONEXCLAMATION);
16            return;
17        }
18    }
19}
20
21char *ReadBuffer( const std::string &path ){
22    extern HANDLE hHeap;
23    int i;
24    DWORD dw;
25    char *buffer,temporary[MAX_PATH];
26    HANDLE hFile;
27
28    hFile=CreateFile(path.c_str(),GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
29    if(hFile==INVALID_HANDLE_VALUE){
30        //"\"%s\" ファイルの読み込みに失敗しました。"
31        sprintf(temporary,STRING_ERROR_CANT_FILEOPEN,path.c_str());
32        MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
33
34        return 0;
35    }
36    i=GetFileSize(hFile,0);
37    buffer=(char *)HeapAlloc(hHeap,0,i+1);
38    ReadFile(hFile,buffer,i,&dw,0);
39    buffer[dw]=0;
40    CloseHandle(hFile);
41    return buffer;
42}
43char *ReadBuffer_NonErrMsg( const std::string &path ){
44    extern HANDLE hHeap;
45    int i;
46    DWORD dw;
47    char *buffer;
48    HANDLE hFile;
49
50    hFile=CreateFile(path.c_str(),GENERIC_READ,FILE_SHARE_READ|FILE_SHARE_WRITE,NULL,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,NULL);
51    if(hFile==INVALID_HANDLE_VALUE) return 0;
52    i=GetFileSize(hFile,0);
53    buffer=(char *)HeapAlloc(hHeap,0,i+1);
54    ReadFile(hFile,buffer,i,&dw,0);
55    buffer[dw]=0;
56    CloseHandle(hFile);
57    return buffer;
58}
59_int8 WriteBuffer(const std::string &path,const char *buffer,int length, bool isEnableError)
60{
61    HANDLE hFile;
62    DWORD dw;
63    hFile=CreateFile(path.c_str(),GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
64    if(hFile==INVALID_HANDLE_VALUE){
65        char temporary[MAX_PATH];
66
67        if( isEnableError ){
68            //"\"%s\" ファイルへの書き込みに失敗しました。"
69            sprintf(temporary,STRING_ERROR_CANT_FILESAVE,path);
70            MessageBox(hOwner,temporary,STRING_ERROR,MB_OK|MB_ICONEXCLAMATION);
71        }
72        return 0;
73    }
74    if(length) WriteFile(hFile,buffer,length,&dw,NULL);
75    CloseHandle(hFile);
76    return 1;
77}
78_int8 WriteBuffer_NonErrMsg(const std::string &path,char *buffer,int length){
79    return WriteBuffer( path, buffer, length, false );
80}
81void GetRelationalPath(char *path,char *dir){
82    //相対パスを取得
83    int i,i2,i3,i4,i5;
84    char temporary[MAX_PATH],temp2[MAX_PATH],temp3[MAX_PATH],temp4[MAX_PATH];
85
86    //ドライブ名をチェック
87    _splitpath(path,temporary,0,0,0);
88    _splitpath(dir,temp2,0,0,0);
89    if(lstrcmpi(temporary,temp2)!=0) return;
90
91    _splitpath(path,0,temporary,0,0);
92    _splitpath(dir,0,temp2,0,0);
93    i=1;i2=1;
94    while(1){
95        i4=i;
96        if(temporary[i-1]=='\\'&&temporary[i]){ //path側
97            for(i3=0;;i++,i3++){
98                if(temporary[i]=='\\'){
99                    temp3[i3]=0;
100                    i++;
101                    break;
102                }
103                temp3[i3]=temporary[i];
104            }
105        }
106        else temp3[0]=0;
107
108        i5=i2;
109        if(temp2[i2-1]=='\\'&&temp2[i2]){       //dir側
110            for(i3=0;;i2++,i3++){
111                if(temp2[i2]=='\\'){
112                    temp4[i3]=0;
113                    i2++;
114                    break;
115                }
116                temp4[i3]=temp2[i2];
117            }
118        }
119        else temp4[0]=0;
120
121        if(temp3[0]=='\0'&&temp4[0]=='\0') break;
122
123        if(lstrcmpi(temp3,temp4)!=0){
124            for(i3=0;;i5++){
125                if(temp2[i5]=='\0') break;
126                if(temp2[i5]=='\\') i3++;
127            }
128            temp3[0]=0;
129            for(i2=0;i2<i3;i2++) lstrcat(temp3,"..\\");
130            lstrcat(temp3,temporary+i4);
131            break;
132        }
133    }
134    _splitpath(path,0,0,temporary,temp2);
135    lstrcat(temp3,temporary);
136    lstrcat(temp3,temp2);
137    lstrcpy(path,temp3);
138}
139void GetFullPath(char *path,const char *dir){
140    int i,i2,i3,i4;
141    char temporary[MAX_PATH];
142
143    if(strstr(path,":")||strstr(path,"\\\\")) return;
144
145    i=0;i2=0;
146    while(1){
147        if(path[i]=='.'&&path[i+1]=='\\') i+=2;
148        if(path[i]=='.'&&path[i+1]=='.'&&path[i+2]=='\\'){
149            i2++;
150            i+=3;
151        }
152        else break;
153    }
154
155    i3=lstrlen(dir);i4=0;
156    while(i4<i2){
157        for(i3--;;i3--){
158            if(dir[i3-1]=='\\'){
159                i4++;
160                break;
161            }
162        }
163    }
164    memcpy(temporary,dir,i3);
165    temporary[i3]=0;
166    lstrcat(temporary,path+i);
167    lstrcpy(path,temporary);
168}
169
170void RemoveDirectoryStrong(const char *dirPath){
171    char tempDirPath[MAX_PATH];
172    lstrcpy( tempDirPath, dirPath );
173
174    if( tempDirPath[lstrlen(tempDirPath)-1] == '\\' ){
175         tempDirPath[lstrlen(tempDirPath)-1] = 0;
176    }
177
178    HANDLE hFind;
179    WIN32_FIND_DATA wfd;
180    char temporary[MAX_PATH];
181    sprintf(temporary,"%s\\*",tempDirPath);
182
183    hFind=FindFirstFile(temporary,&wfd);
184    if(hFind!=INVALID_HANDLE_VALUE){
185        do{
186            if(wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY){
187                if(!(lstrcmp(wfd.cFileName,".")==0||lstrcmp(wfd.cFileName,"..")==0)){
188                    //ディレクトリのとき
189                    sprintf(temporary,"%s\\%s\\",tempDirPath,wfd.cFileName);
190                    RemoveDirectoryStrong(temporary);
191                }
192            }
193            else{
194                //ファイルのとき
195                sprintf(temporary,"%s\\%s",tempDirPath,wfd.cFileName);
196
197                DeleteFile(temporary);
198            }
199        }while(FindNextFile(hFind,&wfd));
200
201        FindClose( hFind );
202    }
203
204    if( !RemoveDirectory(tempDirPath) ){
205        OutputDebugString( GetLastErrorString().c_str() );
206        OutputDebugString( "\r\n" );
207        OutputDebugString( "一時ディレクトリの削除に失敗\r\n" );
208    }
209}
210
211BOOL GetFilePathDialog(HWND hwnd,char *filename,LPSTR Filter,LPSTR Title,_int8 IsOpen){
212    OPENFILENAME ofstr;
213    filename[0]=0;
214    ofstr.lStructSize=sizeof(OPENFILENAME);
215    ofstr.hwndOwner=hwnd;
216    ofstr.hInstance=0;
217    ofstr.lpstrFilter=Filter;
218    ofstr.lpstrCustomFilter=NULL;
219    ofstr.nMaxCustFilter=0;
220    ofstr.nFilterIndex=1;
221    ofstr.lpstrFile=filename;
222    ofstr.nMaxFile=MAX_PATH;
223    ofstr.lpstrFileTitle=NULL;
224    ofstr.nMaxFileTitle=0;
225    ofstr.lpstrInitialDir=pobj_nv->DefSaveDir;
226    ofstr.lpstrTitle=Title;
227    ofstr.Flags=OFN_FILEMUSTEXIST|OFN_HIDEREADONLY|OFN_PATHMUSTEXIST;
228    ofstr.nFileOffset=0;
229    ofstr.nFileExtension=0;
230    ofstr.lpstrDefExt="*";
231    ofstr.lCustData=NULL;
232    ofstr.lpfnHook=NULL;
233    ofstr.lpTemplateName=NULL;
234    if(IsOpen){
235        if(!GetOpenFileName(&ofstr)) return FALSE;
236    }
237    else{
238        if(!GetSaveFileName(&ofstr)) return FALSE;
239    }
240
241    //次回の初期ディレクトリをセット
242    char temporary[MAX_PATH];
243    _splitpath(filename,pobj_nv->DefSaveDir,temporary,NULL,NULL);
244    lstrcat(pobj_nv->DefSaveDir,temporary);
245
246    return TRUE;
247}
248BOOL GetFolder(HWND hWnd,char *folder,char *OpenFolderTitle){
249    BROWSEINFO BrowseInfo;
250    LPITEMIDLIST pidlBrowse;
251    LPMALLOC g_pMalloc;
252    char temporary[MAX_PATH];
253
254    BrowseInfo.hwndOwner=hWnd;
255    BrowseInfo.pszDisplayName=temporary;
256    BrowseInfo.pidlRoot=NULL;
257    BrowseInfo.lpszTitle=OpenFolderTitle;
258    BrowseInfo.ulFlags=BIF_RETURNONLYFSDIRS;
259    BrowseInfo.lpfn=NULL;
260    BrowseInfo.lParam=(LPARAM)0;
261    BrowseInfo.iImage=0;
262    pidlBrowse=SHBrowseForFolder(&BrowseInfo);
263    if(pidlBrowse){
264        if(SHGetMalloc(&g_pMalloc)!=0) return 0;
265        SHGetPathFromIDList(pidlBrowse,folder);
266        g_pMalloc->Free(pidlBrowse);
267        g_pMalloc->Release();
268        return 1;
269    }
270    return 0;
271}
272
273int GetFileExtension( const char *path )
274{
275    char temporary[MAX_PATH];
276    _splitpath(path,0,0,0,temporary);
277
278    if(lstrcmpi(temporary,".bas")==0||
279        lstrcmpi(temporary,".ab")==0||
280        lstrcmpi(temporary,".abp")==0) return FT_BASICPROGRAM;
281    if(lstrcmpi(temporary,".sbp")==0) return FT_SUBPROGRAM;
282    if(lstrcmpi(temporary,".txt")==0) return FT_TEXT;
283    if(lstrcmpi(temporary,".pj")==0) return FT_PROJECT;
284    if(lstrcmpi(temporary,".ico")==0) return FT_ICON;
285
286    if(lstrcmpi(temporary,".html")==0||
287        lstrcmpi(temporary,".htm")==0||
288        lstrcmpi(temporary,".tpl")==0||
289        lstrcmpi(temporary,".php")==0)
290        return FT_HTML;
291
292    return FT_OTHER;
293}
294HWND OpenFileWithExtension( const std::string &filePath )
295{
296    int i;
297    _int8 DocumentType;
298
299    // TODO:
300    char *OpenFileName = const_cast<char *>(filePath.c_str());
301
302    i=GetFileExtension(OpenFileName);
303
304#ifndef THETEXT
305    if(i==FT_PROJECT){
306        //「最近使ったプロジェクト」に追加
307        pobj_nv->pobj_ProjectHistory->insert(OpenFileName);
308
309        projectInfo.Load(OpenFileName);
310        return 0;
311    }
312#endif
313
314    //「最近使ったファイル」に追加
315    pobj_nv->pobj_History->insert(OpenFileName);
316
317    if(i==FT_ICON){
318        NewIconEditWindow(OpenFileName);
319        return 0;
320    }
321    else if(i==FT_BASICPROGRAM||i==FT_SUBPROGRAM){
322        DocumentType=WNDTYPE_BASIC;
323
324#ifdef THETEXT
325        DocumentType=WNDTYPE_TEXT;
326#endif
327    }
328    else if(i==FT_HTML) DocumentType=WNDTYPE_HTML;
329    else DocumentType=WNDTYPE_TEXT;
330
331    COLORREF TabColor;
332    TabColor=pobj_nv->pobj_ExtLink->GetTabColorFromFilePath( filePath );
333
334    return NewTextEditWindow(OpenFileName,DocumentType,TabColor);
335}
336BOOL SaveDocument(HWND hChild,char *SaveFileName){  //ウィンドウからバッファを読み取り、ファイルに保存
337    extern LPSTR IconFileFilter;
338    extern HWND hClient,hDocCombo;
339    int WndNum,i2;
340    char temporary[MAX_PATH],str[MAX_PATH],str2[32];
341    HANDLE fh;
342    DWORD dummy;
343
344    WndNum=GetWndNum(hChild);
345
346    char szOldTitle[MAX_PATH];
347    lstrcpy(szOldTitle,MdiInfo[WndNum]->title.c_str());
348
349    if(MdiInfo[WndNum]->DocType==WNDTYPE_RAD||MdiInfo[WndNum]->DocType==WNDTYPE_MENU){
350        ////////////////////////////////////
351        // RADツール及びメニューエディタ
352        ////////////////////////////////////
353
354        if(projectInfo.ModifyOfMaterial){
355            sprintf(temporary,"%s%s.wnd",projectInfo.GetWorkDir().GetPath().c_str(),projectInfo.GetName().c_str());
356            SaveWindowFile( temporary, projectInfo.windowInfos );
357
358            //.wbpファイルを生成
359            SaveWindowProgram();
360        }
361    }
362    else if(IS_DOCUMENT_TEXT(MdiInfo[WndNum]->DocType)){
363        //////////////////////////
364        // テキストドキュメント
365        //////////////////////////
366
367        if(SaveFileName){
368            lstrcpy(temporary,SaveFileName);
369            if((fh=CreateFile(temporary,GENERIC_WRITE,0,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL))==INVALID_HANDLE_VALUE){
370                sprintf(str,STRING_FILE_OVERWRIDE,temporary);
371                if(MessageBox(hOwner,str,APPLICATION_NAME,MB_YESNO|MB_ICONINFORMATION)==IDNO){
372                    CloseHandle(fh);
373                    return 0;
374                }
375            }
376            CloseHandle(fh);
377
378            //ドキュメント セレクト コンボボックスから消去
379            i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(long)MdiInfo[WndNum]->title.c_str());
380            SendMessage(hDocCombo,CB_DELETESTRING,i2,0);
381
382            //新しいパスをセット
383            MdiInfo[WndNum]->path = temporary;
384
385            //ドキュメント セレクト コンボボックスに挿入
386            _splitpath(temporary,NULL,NULL,str,str2);
387            lstrcat(str,str2);
388            MdiInfo[WndNum]->title = str;
389            SendMessage(hDocCombo,CB_ADDSTRING,0,(long)MdiInfo[WndNum]->title.c_str());
390            i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(long)MdiInfo[WndNum]->title.c_str());
391            SendMessage(hDocCombo,CB_SETCURSEL,i2,0);
392
393            //MDIウィンドウのタイトルを再設定
394            SetWindowText(hChild,MdiInfo[WndNum]->title.c_str());
395        }
396        else{
397            if(MdiInfo[WndNum]->path.empty()){
398                //"保存先のファイルを指定してください"
399get_file_path:
400
401                LPSTR ff;
402
403                extern LPSTR DefFileFilter;
404                extern LPSTR HtmlFileFilter;
405                extern LPSTR TextFileFilter;
406                if(MdiInfo[WndNum]->DocType==WNDTYPE_BASIC)
407                    ff=DefFileFilter;
408                else if(MdiInfo[WndNum]->DocType==WNDTYPE_HTML)
409                    ff=HtmlFileFilter;
410                else if(MdiInfo[WndNum]->DocType==WNDTYPE_TEXT)
411                    ff=TextFileFilter;
412
413                if(!GetFilePathDialog(hOwner,temporary,ff,STRING_FILESAVETITLE_DEFAULT,FALSE)) return 0;
414                SaveDocument(hChild,temporary);
415                return 1;
416            }
417            lstrcpy(temporary,MdiInfo[WndNum]->path.c_str());
418        }
419
420        if(!IsExistFile(temporary)){
421            //保存先ファイルが存在しないとき
422            char temp2[MAX_PATH];
423
424            //初期ディレクトリをセット
425            _splitpath(temporary,pobj_nv->DefSaveDir,temp2,NULL,NULL);
426            lstrcat(pobj_nv->DefSaveDir,temp2);
427
428            goto get_file_path;
429        }
430
431        //文字コードを復元
432        char *pBuf;
433        pBuf=nkf.RestoreBuffer(MdiInfo[WndNum]->pMdiTextEdit->buffer,MdiInfo[WndNum]->pMdiTextEdit->iCharCode);
434
435        //改行コードを復元
436        if(MdiInfo[WndNum]->pMdiTextEdit->iLfCode==LFCODE_LF) nkf.ToLF(pBuf);
437        else if(MdiInfo[WndNum]->pMdiTextEdit->iLfCode==LFCODE_CR) nkf.ToCR(pBuf);
438
439
440        ////////////////////////
441        // 保存
442        ////////////////////////
443
444        fh=CreateFile(temporary,GENERIC_WRITE,0,NULL,CREATE_ALWAYS,FILE_ATTRIBUTE_NORMAL,NULL);
445        if(fh==INVALID_HANDLE_VALUE){
446            sprintf(str,STRING_ERROR_CANT_FILESAVE,temporary);
447            MessageBox(hOwner,str,STRING_ERROR,MB_OK|MB_ICONSTOP);
448            return 0;
449        }
450        WriteFile(fh,pBuf,lstrlen(pBuf),&dummy,NULL);
451        CloseHandle(fh);
452
453
454        HeapDefaultFree(pBuf);
455
456        //変更フラグをオフにする
457        MdiInfo[WndNum]->pMdiTextEdit->UnModify();
458    }
459    else if(MdiInfo[WndNum]->DocType==WNDTYPE_ICONEDIT){
460        ///////////////////
461        // ICON
462        ///////////////////
463
464        if(SaveFileName){
465            lstrcpy(temporary,SaveFileName);
466            if((fh=CreateFile(temporary,GENERIC_WRITE,0,NULL,CREATE_NEW,FILE_ATTRIBUTE_NORMAL,NULL))==INVALID_HANDLE_VALUE){
467                sprintf(str,STRING_FILE_OVERWRIDE,temporary);
468                if(MessageBox(hOwner,str,APPLICATION_NAME,MB_YESNO|MB_ICONINFORMATION)==IDNO){
469                    CloseHandle(fh);
470                    return 0;
471                }
472            }
473            CloseHandle(fh);
474            MdiInfo[WndNum]->path = temporary;
475            i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(long)MdiInfo[WndNum]->title.c_str());
476            SendMessage(hDocCombo,CB_DELETESTRING,i2,0);
477            _splitpath(temporary,NULL,NULL,str,str2);
478            lstrcat(str,str2);
479            MdiInfo[WndNum]->title = str;
480            SendMessage(hDocCombo,CB_ADDSTRING,0,(long)MdiInfo[WndNum]->title.c_str());
481            i2=SendMessage(hDocCombo,CB_FINDSTRINGEXACT,0,(long)MdiInfo[WndNum]->title.c_str());
482            SendMessage(hDocCombo,CB_SETCURSEL,i2,0);
483            SetWindowText(hChild,MdiInfo[WndNum]->title.c_str());
484        }
485        else{
486            if(MdiInfo[WndNum]->path.empty()){
487                //"保存先のファイルを指定してください"
488                if(!GetFilePathDialog(hOwner,temporary,IconFileFilter,STRING_FILESAVETITLE_DEFAULT,FALSE)) return 0;
489                SaveDocument(hChild,temporary);
490                return 1;
491            }
492            lstrcpy(temporary,MdiInfo[WndNum]->path.c_str());
493        }
494        SaveIconFile(temporary,hChild);
495
496        MdiInfo[WndNum]->MdiIconEditInfo->bModify=0;
497    }
498
499
500    //タブコントロールを再設定
501    if(pobj_nv->bSaveTabToHead){
502        COLORREF color;
503        color=pobj_MainTab->GetItemColor(szOldTitle);
504        pobj_MainTab->DeleteItem( szOldTitle, false );
505        pobj_MainTab->InsertItem( MdiInfo[WndNum]->title.c_str(), false, color );
506    }
507    else{
508        pobj_MainTab->RenameItem( szOldTitle, MdiInfo[WndNum]->title.c_str() );
509    }
510
511    //「最近使ったファイル」を更新
512    pobj_nv->pobj_History->insert(MdiInfo[WndNum]->path.c_str());
513
514    return 1;
515}
516BOOL ShortPathToLongPath(char ShortPath[MAX_PATH],char *LongPath){
517    HANDLE hFind;
518    WIN32_FIND_DATA wfd;
519    int i;
520    char dummy[MAX_PATH];
521    for(i=0;i<MAX_PATH;i++){
522        LongPath[i]=ShortPath[i];
523        if((ShortPath[i-1]==':'&&ShortPath[i]=='\\')||(ShortPath[i-1]=='\\'&&ShortPath[i]=='\\')){
524            LongPath[i+1]=0;
525            break;
526        }
527    }
528    if(ShortPath[i-1]=='\\'&&ShortPath[i]=='\\'){
529        for(i++;i<MAX_PATH;i++){
530            if(IsDBCSLeadByte(ShortPath[i])){
531                i++;
532                continue;
533            }
534            LongPath[i]=ShortPath[i];
535            if(ShortPath[i]=='\\'){
536                LongPath[i+1]=0;
537                break;
538            }
539        }
540        for(i++;i<MAX_PATH;i++){
541            if(IsDBCSLeadByte(ShortPath[i])){
542                i++;
543                continue;
544            }
545            LongPath[i]=ShortPath[i];
546            if(ShortPath[i]=='\\'){
547                LongPath[i+1]=0;
548                break;
549            }
550        }
551    }
552    for(i++;i<MAX_PATH;i++){
553        if(IsDBCSLeadByte(ShortPath[i])){
554            i++;
555            continue;
556        }
557        if(ShortPath[i]=='\\'||ShortPath[i]=='\0'){
558            strncpy(dummy,ShortPath,i);
559            dummy[i]=0;
560            if((hFind=FindFirstFile(dummy,&wfd))!=INVALID_HANDLE_VALUE) FindClose(hFind);
561            lstrcat(LongPath,wfd.cFileName);
562
563            if(ShortPath[i]=='\0') break;
564            lstrcat(LongPath,"\\");
565
566            if(ShortPath[i]=='\\'&&ShortPath[i+1]=='\0'){
567                break;
568            }
569        }
570    }
571    return 1;
572}
573
574bool IsExistFile( const char *FilePath ){
575    WIN32_FIND_DATA wfd;
576    HANDLE hFind;
577
578    hFind = FindFirstFile(FilePath,&wfd);
579    if( hFind == INVALID_HANDLE_VALUE ){
580        return false;
581    }
582    FindClose( hFind );
583
584    return true;
585}
586
587bool IsExistDirectory( const char *DirPath ){
588    WIN32_FIND_DATA wfd;
589    HANDLE hFind;
590
591    hFind = FindFirstFile(DirPath,&wfd);
592    if( hFind == INVALID_HANDLE_VALUE ){
593        //存在しない
594        return false;
595    }
596    FindClose( hFind );
597
598    if( wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ){
599        //ディレクトリの場合
600        return true;
601    }
602
603    //存在しない
604    return false;
605}
Note: See TracBrowser for help on using the repository browser.