]> Chaos Git - corbenik/ctrulib.git/commitdiff
set default device so relative paths work in 3dmoo
authorDave Murphy <davem@devkitpro.org>
Mon, 8 Dec 2014 23:21:09 +0000 (23:21 +0000)
committerDave Murphy <davem@devkitpro.org>
Mon, 8 Dec 2014 23:21:46 +0000 (23:21 +0000)
libctru/source/sdmc_dev.c

index 4d481176e7ced9d311f5428aa10bcf4ac5af8715..1450574301ccd7155f4e3a0e73330b3b8bc209fb 100644 (file)
@@ -140,15 +140,18 @@ Result sdmcInit(void)
 
     int dev = AddDevice(&sdmc_devoptab);
 
-    if (__system_argc != 0 && __system_argv[0] != NULL)
-    {
-      if (FindDevice(__system_argv[0]) == dev)
+    if (dev != -1) {
+      setDefaultDevice(dev);
+      if (__system_argc != 0 && __system_argv[0] != NULL)
       {
-        strncpy(__fixedpath,__system_argv[0],PATH_MAX);
-        char *last_slash = strrchr(__fixedpath,'/');
-        if (last_slash != NULL) {
-          last_slash[0] = 0;
-          chdir(__fixedpath);
+        if (FindDevice(__system_argv[0]) == dev)
+        {
+          strncpy(__fixedpath,__system_argv[0],PATH_MAX);
+          char *last_slash = strrchr(__fixedpath,'/');
+          if (last_slash != NULL) {
+            last_slash[0] = 0;
+            chdir(__fixedpath);
+          }
         }
       }
     }