Fixes to run dfu-util from scsi2sd-util6 on mac v6.0.5
authorMichael McMaster <michael@codesrc.com>
Sat, 13 Aug 2016 21:11:23 +0000 (07:11 +1000)
committerMichael McMaster <michael@codesrc.com>
Sat, 13 Aug 2016 21:11:23 +0000 (07:11 +1000)
src/scsi2sd-util6/Makefile
src/scsi2sd-util6/scsi2sd-util.cc

index b066959..28a1036 100755 (executable)
@@ -113,7 +113,7 @@ $(BUILD)/scsi2sd-util6.dmg: $(BUILD)/scsi2sd-util6 $(BUILD)/dfu-util/buildstamp
        mkdir -p $(dir $@)/dmg
        cp $(BUILD)/scsi2sd-util6 $(BUILD)/dfu-util/src/dfu-util $(dir $@)/dmg
        chmod a+rx $(dir $@)/dmg/*
-       hdiutil create -srcfolder $(dir $@)/dmg $@
+       hdiutil create -volname scsi2sd-util6 -srcfolder $(dir $@)/dmg $@
 endif
 
 export CC CXX
index c91de12..4f1209f 100644 (file)
@@ -32,6 +32,7 @@
 #include <wx/utils.h>
 #include <wx/wfstream.h>
 #include <wx/windowptr.h>
+#include <wx/stdpaths.h>
 #include <wx/stream.h>
 #include <wx/thread.h>
 #include <wx/txtstrm.h>
@@ -533,8 +534,19 @@ private:
 
 
                std::stringstream ss;
+#ifdef __WINDOWS__
                ss << "dfu-util --download \""
                        << filename.c_str() << "\" --alt 0 --reset";
+#else
+               if (wxExecute("which dfu-util", wxEXEC_SYNC) == 0)
+               {
+                       ss << "dfu-util ";
+               } else {
+                       wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
+                       ss << exePath.GetPathWithSep() << "dfu-util ";
+               }
+               ss << "--download \"" << filename.c_str() << "\" --alt 0 --reset";
+#endif
 
                wxLogMessage("Running: %s", ss.str());
 
@@ -546,19 +558,6 @@ private:
                        wxEXEC_ASYNC,
                        myConsoleProcess.get()
                        );
-#ifndef __WINDOWS__
-               if (!result)
-               {
-                       // Try again using the current directory
-                       cmd = std::string("./") + cmd;
-                       wxLogMessage("Running: %s", cmd);
-                       result = wxExecute(
-                               cmd.c_str(),
-                               wxEXEC_ASYNC,
-                               myConsoleProcess.get()
-                               );
-               }
-#endif
                if (!result)
                {
                        wxMessageBox(