+options --cdrom and --disk
authorshort <>
Thu, 16 Jan 2003 03:36:28 +0000 (03:36 +0000)
committershort <>
Thu, 16 Jan 2003 03:36:28 +0000 (03:36 +0000)
+variable 'captive_option_media'

src/libcaptive/client/lib.c

index ed4ef28..9c80d9c 100644 (file)
@@ -27,6 +27,7 @@
 #include "captive/unicode.h"
 #include <libgnomevfs/gnome-vfs-utils.h>       /* for gnome_vfs_unescape_string() */
 #include <glib/gprintf.h>
+#include "captive/client.h"
 
 
 /* function will leave g_malloc()ed 'ObjectAttributes->ObjectName'!
@@ -34,6 +35,7 @@
 GnomeVFSResult captive_ObjectAttributes_init(const gchar *pathname,OBJECT_ATTRIBUTES *ObjectAttributes)
 {
 gchar *w32_path,*s,*d;
+const gchar *media_root;
 
        g_return_val_if_fail(pathname!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
        g_return_val_if_fail(ObjectAttributes!=NULL,GNOME_VFS_ERROR_BAD_PARAMETERS);
@@ -49,8 +51,16 @@ gchar *w32_path,*s,*d;
         * On the other side it will somehow get managed automatically and it works even
         * without the trailing "\\." for root directory open - don't ask me why. :-)
         */
+       switch (captive_option_media) {
+               case CAPTIVE_OPTION_MEDIA_CDROM: media_root="\\Device\\CdRom0";           break;        /* libcaptive/storage/cdrom.c */
+               case CAPTIVE_OPTION_MEDIA_DISK:  media_root="\\Device\\CaptiveHarddisk0"; break;        /* libcaptive/storage/disk.c */
+               default:
+                       g_assert_not_reached();
+                       media_root="";
+               }
+
        w32_path=(gchar *)/* de-const it as we can modify it but we must not free() it */
-                       captive_printf_alloca("\\Device\\CdRom0\\%s",pathname);
+                       captive_printf_alloca("%s\\%s",media_root,pathname);
        /* translate '/' -> '\' */
        for (s=w32_path;(s=strchr(s,'/'));s++)
                *s='\\';