Changeset 1220

Show
Ignore:
Timestamp:
07/05/09 14:08:48 (3 years ago)
Author:
andrei
Message:

Incorporated changes suggested by Adam Ruppe, see http://www.digitalmars.com/webnews/newsgroups.php?art_group=digitalmars.D&article_id=92769

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/tools/rdmd.d

    r1219 r1220  
    55    std.algorithm, std.iterator, std.md5, std.path, std.regexp, std.getopt, 
    66    std.c.stdlib, std.process; 
     7 
     8version (Posix) 
     9{ 
     10    enum objExt = ".o"; 
     11    enum binExt = ""; 
     12} 
     13else version (Windows) 
     14{ 
     15    enum objExt = ".obj"; 
     16    enum binExt = ".exe"; 
     17} 
     18else 
     19{ 
     20    static assert(0); 
     21} 
    722 
    823private bool chatty, buildOnly, dryRun, force; 
     
    113128    const compilerFlags = args[1 .. programPos]; 
    114129 
    115     // Change to the main module's directory; all searches will be 
    116     // relative to that directory 
    117     // auto initialDir = getcwd; 
    118     // chdir(exeDirname); 
    119     // scope(exit) chdir(initialDir); 
    120  
    121130    // Compute the object directory and ensure it exists 
    122131    invariant objDir = getObjPath(root, compilerFlags); 
     
    154163            assert(0); 
    155164    } 
     165    // Add an ".exe" for Windows 
     166    exe ~= binExt;  
    156167 
    157168    // Have at it 
     
    193204            tmpRoot = std.process.getenv("TMP"); 
    194205        } 
    195         if (!tmpRoot) tmpRoot = "./.rdmd"
    196         else tmpRoot ~= "/.rdmd"; 
     206        if (!tmpRoot) tmpRoot = join(".", ".rdmd")
     207        else tmpRoot ~= pathsep ~ ".rdmd"; 
    197208    } 
    198209    exists(tmpRoot) && isdir(tmpRoot) || mkdirRecurse(tmpRoot); 
     
    254265        return result; 
    255266    } 
    256     // clean up the object file, not needed anymore 
    257     //remove(std.path.join(objDir, basename(root, ".d")~".o")); 
    258267    // clean up the dir containing the object file 
    259268    rmdirRecurse(objDir); 
     
    279288{ 
    280289    string d2obj(string dfile) { 
    281         return std.path.join(objDir, chomp(basename(dfile), ".d")~".o"); 
     290        return std.path.join(objDir, chomp(basename(dfile), ".d")~objExt); 
    282291    } 
    283292