/[projet1]/public/pc/tools/osdk/main/common/sources/common.cpp
Defence Force logotype

Diff of /public/pc/tools/osdk/main/common/sources/common.cpp

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

revision 1320 by dbug, Thu Oct 22 19:04:48 2015 UTC revision 1321 by dbug, Sat Oct 24 15:53:43 2015 UTC
# Line 9  Line 9 
9  #ifdef WIN32  #ifdef WIN32
10  /* for getch() */  /* for getch() */
11  #include <conio.h>  #include <conio.h>
12    #include <windows.h>
13    
14    #ifdef DeleteFile
15    #undef DeleteFile
16    #endif
17    
18  #else  #else
19  /* for getch() */  /* for getch() */
20  #include <curses.h>  #include <curses.h>
# Line 100  bool LoadFile(const char* pcFileName,voi Line 106  bool LoadFile(const char* pcFileName,voi
106    pcBuffer=malloc(cBufferSize+1);    pcBuffer=malloc(cBufferSize+1);
107    if (!pcBuffer)    if (!pcBuffer)
108    {    {
109        close(nHandle);
110      return false;      return false;
111    }    }
112    
# Line 872  std::string TextFileGenerator::ConvertDa Line 879  std::string TextFileGenerator::ConvertDa
879    return cDestString;    return cDestString;
880  }  }
881    
882    std::string ExpandFilePath(const std::string& sourceFile)
883    {
884      char fullPathName[4096];
885      char* filePosition;
886      GetFullPathName(sourceFile.c_str(),sizeof(fullPathName),fullPathName,&filePosition);
887      if (filePosition)
888      {
889        // If there's a filename, cut it out.
890        *filePosition=0;
891      }
892      return fullPathName;
893    }
894    
895    int ExpandFileList(const std::string& sourceFile,std::vector<std::string>& resolvedFileList)
896    {
897      resolvedFileList.clear();
898    
899      WIN32_FIND_DATA findData;
900      HANDLE findhandle=FindFirstFile(sourceFile.c_str(),&findData);
901      if (findhandle!=INVALID_HANDLE_VALUE)
902      {
903        do
904        {
905          resolvedFileList.push_back(findData.cFileName);
906        }
907        while (FindNextFile(findhandle,&findData));
908        FindClose(findhandle);
909      }
910    
911      return (int)resolvedFileList.size();
912    }
913    
914    

Legend:
Removed from v.1320  
changed lines
  Added in v.1321

  ViewVC Help
Powered by ViewVC 1.1.26