Re: symlink, scp:// and filepath slashes

Bram Moolenaar <[email protected]> Tue, 02 Mar 2004 20:50:07 +0100
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Scott Henry Harrison wrote:

> >> :symlink $(WEBDIR)/welcome.html $(WEBDIR)/index.html  
> >> 
> > 
> > I don't see "scp://" or $PREFIX being used there.  Anyway, Aap cannot
> > make a symbolic link over scp://.  It is only supported for local files.
> > One exception is "rsync://", although the default setting is to copy the
> > file a link points to, not the link itself.  You can define $RSYNC to
> > change that.  But then it still only works for :copy, not for :symlink.
> 
> Will symlink-scp support ever be extended for remote files?
> (Would a patch be welcome?) 

If I look in my todo list, there are more important things to do.  But
if you can make a patch that is tested I would be tempted to included
it. :-)

> >> Also, filepath slashing seems a little unintelligent 
> >> 
> >> WEBDIR=usr/local/www/data
> >> :symlink $(WEBDIR)welcome.html $(WEBDIR)index.html  
> >> 
> >> :symlink "usr/local/www/datawelcome.html" "usr/local/www/dataindex.html" 
> >> failed: [Errno 2] No such file or directory 
> > 
> > You have to take care of slashes yourself in this situation.  Aap sees
> > only strings, it doesn't know that these are file names until the
> > arguments are used.  Compare that with a shell script.
> 
> Aap is intelligent with slashes in other situations.  Could intelligent
> handling of slashes be implemented (and would a patch be welcome)? 

This is supported in places where Aap concatenates parts of a file name.
But in this example Aap doesn't know that you are concatenating this
way.  It could also be that $WEBDIR is "my", to make "mywelcome.html".

> I respect your vision for why things are the way they are with A-A-P;
> I am just wondering what the future is, and if intelligent slash-handling
> and scp+symlink processing is extraneous in terms of the overall
> goals or keep-it-simple-notions you have for the software. 

I certainly hope to further improve Aap and make it easier to use.  But
the basic string handling and variable expansion can't be changed much
without causing confusion.

You can use a Python function for concatenation:

	`os.path.join(_no.WEBDIR, "welcome.html")`

It will insert a "/" or "\" or ":" as needed.  Although a "\" might
sometimes cause trouble, but that's an MS-Windows problem.

I could add an Aap function for this, but that won't make it
much easier and means another Aap-specific thing to learn.  Perhaps
using "join()" instead of "os.path.join()" could be used (also for a few
more often used functions, such as glob()).

-- 
FATHER: We are here today to witness the union of two young people in the
        joyful bond of the holy wedlock.  Unfortunately, one of them, my son
        Herbert, has just fallen to his death.
   [Murmurs from CROWD;  the BRIDE smiles with relief, coughs.]
                 "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click