Re: Creating $BDIR before :conf ? [PATCH]

Bram Moolenaar <[email protected]> Fri, 25 Nov 2005 17:40:22 +0100
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
Adriaan de Groot wrote:

> On Friday 25 November 2005 16:40, Bram Moolenaar wrote:
> > Adriaan de Groot wrote:
> > > :conf write header $BDIR/config.h
> > >
> > > Works, sortof. :conf write header doesn't create $BDIR
> >
> > I don't think it is a job of ":conf init".  ":conf write header" woul=
d
> > be a logical place to make sure the destination directory exists.
> > This can be done either by recognizing that $BDIR is being used, or j=
ust
> > for any directory.  I think the last is preferred.
>=20
> Attached patch tries to create the path for the written file and solves=
 my=20
> problem. I'm not sure what should be done with remote files for writing=
 the=20
> header.

Another method is to pass the "mkdir" attribute to remote_copy_move().
Can you try out the patch below?

Perhaps the "force" attribute should also be set, so that the file is
overwritten when it already exists?  I would think a user expects this
file to be overwritten without a warning.


--- DoConf.py~	Fri Sep  5 17:04:48 2003
+++ DoConf.py	Fri Nov 25 17:28:05 2005
@@ -268,7 +268,7 @@
             from CopyMove import remote_copy_move
             remote_copy_move(rpstack, recdict, 1,
                              [ {"name" : context.headerfilename} ],
-                             { "name" : fname }, {}, 0, errmsg =3D 1)
+                             { "name" : fname }, {'mkdir' : 1}, 0, errms=
g =3D 1)
         elif what =3D=3D "recipe":
             try:
                 f =3D open(fname, "w")

--=20
hundred-and-one symptoms of being an internet addict:
206. You religiously respond immediately to e-mail, while ignoring
     your growing pile of snail mail.

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \=
\\
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ =
\\\
\\\        download, build and distribute -- http://www.A-A-P.org        =
///
 \\\            help me help AIDS victims -- http://www.ICCF.nl         /=
//


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log fi=
les
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=3D7637&alloc_id=3D16865&op=3Dclick