/[svn]/linuxsampler/trunk/src/network/lscpserver.cpp
ViewVC logotype

Diff of /linuxsampler/trunk/src/network/lscpserver.cpp

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

revision 1536 by schoenebeck, Mon Dec 3 16:41:17 2007 UTC revision 1537 by senoner, Mon Dec 3 18:30:47 2007 UTC
# Line 26  Line 26 
26  #include "lscpevent.h"  #include "lscpevent.h"
27    
28  #if defined(WIN32)  #if defined(WIN32)
29    #include <windows.h>
30  #else  #else
31  #include <fcntl.h>  #include <fcntl.h>
32  #endif  #endif
# Line 2517  String LSCPServer::GetFileInstrumentInfo Line 2518  String LSCPServer::GetFileInstrumentInfo
2518  }  }
2519    
2520  void LSCPServer::VerifyFile(String Filename) {  void LSCPServer::VerifyFile(String Filename) {
2521        #if WIN32
2522        WIN32_FIND_DATA win32FileAttributeData;
2523        BOOL res = GetFileAttributesEx( Filename.c_str(), GetFileExInfoStandard, &win32FileAttributeData );
2524        if (!res) {
2525            std::stringstream ss;
2526            ss << "File does not exist, GetFileAttributesEx failed `" << Filename << "`: Error " << GetLastError();
2527            throw Exception(ss.str());
2528        }
2529        if ( win32FileAttributeData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) {
2530            throw Exception("Directory is specified");
2531        }
2532        #else    
2533      struct stat statBuf;      struct stat statBuf;
2534      int res = stat(Filename.c_str(), &statBuf);      int res = stat(Filename.c_str(), &statBuf);
2535      if (res) {      if (res) {
# Line 2528  void LSCPServer::VerifyFile(String Filen Line 2541  void LSCPServer::VerifyFile(String Filen
2541      if (S_ISDIR(statBuf.st_mode)) {      if (S_ISDIR(statBuf.st_mode)) {
2542          throw Exception("Directory is specified");          throw Exception("Directory is specified");
2543      }      }
2544        #endif
2545  }  }
2546    
2547  /**  /**

Legend:
Removed from v.1536  
changed lines
  Added in v.1537

  ViewVC Help
Powered by ViewVC