Mercurial > projects > ldc
comparison dmd/module.c @ 598:13ff06605226
To prevert source-overwriting in the future, forbit output files with the same
name as the source file.
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sun, 14 Sep 2008 22:49:19 +0200 |
parents | 8cc0c46064b1 |
children | a30fc28e8f23 |
comparison
equal
deleted
inserted
replaced
597:8cc0c46064b1 | 598:13ff06605226 |
---|---|
170 return; | 170 return; |
171 | 171 |
172 objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.bc_ext); | 172 objfile = Module::buildFilePath(global.params.objname, global.params.objdir, global.bc_ext); |
173 docfile = Module::buildFilePath(global.params.docname, global.params.docdir, global.doc_ext); | 173 docfile = Module::buildFilePath(global.params.docname, global.params.docdir, global.doc_ext); |
174 hdrfile = Module::buildFilePath(global.params.hdrname, global.params.hdrdir, global.hdr_ext); | 174 hdrfile = Module::buildFilePath(global.params.hdrname, global.params.hdrdir, global.hdr_ext); |
175 | |
176 // safety check: never allow obj, doc or hdr file to have the source file's name | |
177 if(stricmp(FileName::name(objfile->name->str), FileName::name((char*)this->arg)) == 0 || | |
178 stricmp(FileName::name(docfile->name->str), FileName::name((char*)this->arg)) == 0 || | |
179 stricmp(FileName::name(hdrfile->name->str), FileName::name((char*)this->arg)) == 0) | |
180 { | |
181 error("Object-, ddoc-, and header- output files with the same name as the source file are forbidden"); | |
182 fatal(); | |
183 } | |
175 } | 184 } |
176 | 185 |
177 void Module::deleteObjFile() | 186 void Module::deleteObjFile() |
178 { | 187 { |
179 if (global.params.obj) | 188 if (global.params.obj) |