Ignore:
Timestamp:
02/09/2006 11:44:29 (6 years ago)
Author:
chris
Message:

(refs #3)

Convert UNIX paths to native on Win32 (avoids #ifdefs in tests)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • box/chris/merge/lib/common/Test.h

    r456 r927  
    8080} 
    8181 
    82 inline int LaunchServer(const char *CommandLine, const char *pidFile) 
    83 { 
    84         if(::system(CommandLine) != 0) 
    85         { 
    86                 printf("Server: %s\n", CommandLine); 
     82inline int LaunchServer(const char *pCommandLine, const char *pidFile) 
     83{ 
     84#ifdef WIN32 
     85        // convert UNIX paths to native 
     86 
     87        std::string command; 
     88        for (int i = 0; pCommandLine[i] != 0; i++) 
     89        { 
     90                if (pCommandLine[i] == '/') 
     91                { 
     92                        command += '\\'; 
     93                } 
     94                else 
     95                { 
     96                        command += pCommandLine[i]; 
     97                } 
     98        } 
     99 
     100#else // !WIN32 
     101        std::string command = pCommandLine; 
     102#endif 
     103 
     104        if(::system(command.c_str()) != 0) 
     105        { 
     106                printf("Server: %s\n", command.c_str()); 
    87107                TEST_FAIL_WITH_MESSAGE("Couldn't start server"); 
    88108                return -1; 
     
    94114        if(!TestFileExists(pidFile)) 
    95115        { 
    96                 printf("Server: %s\n", CommandLine); 
     116                printf("Server: %s\n", command.c_str()); 
    97117                TEST_FAIL_WITH_MESSAGE("Server didn't save PID file");   
    98118                return -1; 
     
    103123        if(f == NULL || fscanf(f, "%d", &pid) != 1) 
    104124        { 
    105                 printf("Server: %s (pidfile %s)\n", CommandLine, pidFile); 
     125                printf("Server: %s (pidfile %s)\n", command.c_str(), pidFile); 
    106126                TEST_FAIL_WITH_MESSAGE("Couldn't read PID file");        
    107127                return -1; 
Note: See TracChangeset for help on using the changeset viewer.