Drive View in Konqueror

Chris January kde-cygwin@mail.kde.org
Tue, 16 Apr 2002 02:53:24 +0100


> > Hi Chris,
> >
> > while the most of my time spent for kde is currently in
> > analysing performance issues and preparing the kde 2.2.2
> > release (kase and libs), I have found some time to look at
> > your konqueror drives patch, which looks very
> > nice.
> >
> > One problem I have recognized is that you have chooses a
> > static /cygdrive/ prefix for the mount point, which
> > fails it the cygwin user has changed this.
> >
> > The functions I have found this is:
> >
> > void
> qDrivesModule::addTopLevelItem(
> > KonqTreeTopLevelItem
> > * item )
> >
> >
> > I have identified, that the method
> > "mount_info::get_cygdrive_info (char *user, char *system,
> > char* user_flags)!" in cygwins src/winsup/cygwin/path.cc
> > file contains the related registry accesses.
> >
> >   reg_key r2 (HKEY_LOCAL_MACHINE, KEY_READ, "SOFTWARE",
> >       CYGWIN_INFO_CYGNUS_REGISTRY_NAME,
> > CYGWIN_REGNAME,
> >       CYGWIN_INFO_CYGWIN_MOUNT_REGISTRY_NAME,
> >       NULL);
> >
> >   int res2 = r2.get_string (CYGWIN_INFO_CYGDRIVE_PREFIX,
> > system, MAX_PATH, "");
> >
> A better way to solve this seems to be using the cygwin_interal() call
like used in the utils/mount.cc tool.
>
> #include <sys/cygwin.h>
> ...
>
> /* get the user and system cygdrive path prefix, if necessary
>    (ie, not empty) */
> char user[MAX_PATH];
> char system[MAX_PATH];
> char user_flags[MAX_PATH];
> char system_flags[MAX_PATH];
> char *cygprefix;
>
> cygwin_internal (CW_GET_CYGDRIVE_INFO, user, system, user_flags,
>    system_flags);
>
> if (strlen (user) > 0)
>   cygprefix = user;
> if (strlen (system) > 0)
>   cygprefix = system;
>
> then cygprefix is "/cygprefix" is it is set to default
I've added this in and committed the changes. Perhaps you could test them
for me - my kde-cygwin install is totally broken at present.... :-)

Regards
Chris