This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: CWD and long paths


On 10/12/07, Corinna Vinschen wrote:
> On Oct 12 09:22, Lev Bishop wrote:
> > On 10/12/07, Corinna Vinschen wrote:
> >
> > > In Cygwin we can do as we like, so we can handle CWDs with long path
> > > names without problems.  Unfortunately we have to call non-Cygwin
> > > applications once in a while and then it gets weird.
> > >
> > > So, here's the question: How should we handle the CWD in future?
> > >
> > > - We could stick to only supporting CWDs of MAX_PATH length so we don't
> > >   have a problem when calling native apps.
> > >
> > > - We could support long CWDs and change the CWD to the longest path
> > >   prefix <= MAX_PATH as soon as we call a native app.
> > >
> > > - Something else?
> >
> > Something like:
> >
> > subst t: prefix\of\long\path
> > t:
> > cd rest\of\long\path
> > win32_command
> > subst /d t:
> >
> > This allows to get up to 2*MAX_PATH and can be iterated to get deeper.
> >
> > Ugly, I know, but maybe better than the alternatives?
>
> I don't think so.  First, it only helps for 2 * MAX_PATH, as you say.
> Second, it's a method only working for users.  How should that work for
> the DLL without user intervention?  Searching the next free drive letter
> and use it?  What if this is by chance the drive letter used for, say,
> the user's USB drive and scripts or apps are relying on the drive
> letter?  What if all drive letters are taken?  That doesn't sound very
> reliable.

Ok, then. How about something roughly like this:

CreateJunctionPoint("/very/long/path/","/temp/shortpath");
SetCwd("/temp/shortpath");
Execute(win32_exe);
RemoveDirectory("/temp/shortpath");

I believe junction point targets can as be as long as the NTFS maximum.

Or if you wanted to get fancy, I bet there's a way to make an
Installable File System filter driver that would automagically rewrite
requests to a single generic directory, say, C:\shortenedpaths to the
working directory for the process that generated the request.

Lev


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]