Drive View in Konqueror

Ralf Habacker kde-cygwin@mail.kde.org
Fri, 12 Apr 2002 07:54:51 +0200


Ralf Habacker


> -----Original Message-----
> From: kde-cygwin-admin@mail.kde.org
> [mailto:kde-cygwin-admin@mail.kde.org]On Behalf
> Of Ralf Habacker
> Sent: Thursday, April 11, 2002 10:20 PM
> To: Kde-Cygwin
> Subject: Drive View in Konqueror
>
>
> 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 

Regards 
> Ralf Habacker