Re: Adding a bdir() function
Bram Moolenaar <[email protected]>
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
Adriaan de Groot wrote: > The attached patch adds a bdir() function to RecPython.py. The purpose > of this function is to prepend $BDIR to a (list of) filename. The > primary use is in actions, where using a construction like > > $BDIR/$-target may not be the right thing to do if $target already has > $BDIR prefixed to it. It certainly helps in the Qt module (patch also > attached). So instead, you can use `bdir(target)` which DTRT (IMO). I see a few problems/doubts here: - You explicitly use "/" instead of using os.path.join(). Python purists don't like this. - What if the current value of $BDIR is different from the build directory in the file name? An alternative would be to always remove the build dir from the file name and then prepend $BDIR. - Instead of checking for "build-" the locate_bdir() function can be used. This also takes care of ignoring case on MS-Windows. > The check to see if $BDIR is already in the filename is a little > primitive, though it might be broken by some creative soul with a > build-me/ subdirectory in a project. Perhaps I should also check for > the os name? And what if the OS name is "me"? :-) I think the user should be aware that Aap recognizes "build-me" as a build directory. That doesn't appear to be a bad restriction. Unless some wide-spread project does use this directory perhaps. -- Why doesn't Tarzan have a beard? /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html /// ------------------------------------------------------- This SF.net email is sponsored by OSDN developer relations Here's your chance to show off your extensive product knowledge We want to know what you know. Tell us and you have a chance to win $100 http://www.zoomerang.com/survey.zgi?HRPT1X3RYQNC5V4MLNSV3E54