Add uninstaller for the .pkg part of the disk writer on macOS (#1740).
authorCarl Hetherington <cth@carlh.net>
Sat, 24 Oct 2020 18:44:24 +0000 (20:44 +0200)
committerCarl Hetherington <cth@carlh.net>
Tue, 27 Oct 2020 20:45:32 +0000 (21:45 +0100)
platform/osx/make_dmg.sh
platform/osx/set_paths.sh
platform/osx/uninstall_disk.applescript [new file with mode: 0644]
run/dcpomatic_disk
src/tools/dcpomatic_disk.cc

index 850a2a4f7acd7b2ca0b005658927ef15b07203e8..a6755e918a6613273b88d81a83009471b258cb45 100644 (file)
@@ -516,6 +516,7 @@ make_dmg "$appdir" "" "DCP-o-matic Combiner"
 setup "DCP-o-matic 2 Disk Writer.app"
 copy $ROOT src/dcpomatic/build/src/tools/dcpomatic2_disk "$approot/MacOS"
 copy $ROOT src/openssl/apps/openssl "$approot/MacOS"
+cp $prefix/src/dcpomatic/platform/osx/uninstall_disk.applescript "$approot/Resources"
 cp $prefix/src/dcpomatic/build/platform/osx/dcpomatic2_disk.Info.plist "$approot/Info.plist"
 rl=("$approot/MacOS/dcpomatic2_disk" "$approot/Frameworks/"*.dylib)
 relink_relative "${rl[@]}"
index 68db2e2b2759f36959bf788eaec8a5277b70d866..5a84a82d951e797eb389cc45f5d450826c8a946f 100644 (file)
@@ -1,4 +1,4 @@
-base=$HOME/test
+base=$HOME/dcpomatic
 env=$HOME/osx-environment
 sdk=$HOME/SDK
 
diff --git a/platform/osx/uninstall_disk.applescript b/platform/osx/uninstall_disk.applescript
new file mode 100644 (file)
index 0000000..75caee3
--- /dev/null
@@ -0,0 +1,24 @@
+--    Copyright (C) 2020 Carl Hetherington <cth@carlh.net>
+--
+--    This file is part of DCP-o-matic.
+--
+--    DCP-o-matic is free software; you can redistribute it and/or modify
+--    it under the terms of the GNU General Public License as published by
+--    the Free Software Foundation; either version 2 of the License, or
+--    (at your option) any later version.
+--
+--    DCP-o-matic is distributed in the hope that it will be useful,
+--    but WITHOUT ANY WARRANTY; without even the implied warranty of
+--    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--    GNU General Public License for more details.
+--
+--    You should have received a copy of the GNU General Public License
+--    along with DCP-o-matic.  If not, see <http://www.gnu.org/licenses/>.
+
+set askText to "Do you want to uninstall the .pkg part of the DCP-o-matic Disk Writer?"
+set reply to (display dialog askText buttons {"Cancel", "Uninstall"} default button "Uninstall" cancel button "Cancel")
+if button returned of reply = "Uninstall" then
+       do shell script "rm -rf \"/Library/Application Support/com.dcpomatic\"" with administrator privileges
+       set doneText to "Uninstall complete.  Now close and delete the DCP-o-matic Disk Writer app."
+       display dialog doneText buttons {"OK"}
+end if
index 990800461bc36d2764f1a0c5db215dd3e01c9c9e..ce8366012c1129124476ea5ff30700e75a59f759 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/bash
 
 export LD_LIBRARY_PATH=build/src/lib:build/src/wx:build/src/asdcplib/src:$LD_LIBRARY_PATH
-export DYLD_LIBRARY_PATH=build/src/lib:build/src/wx:build/src/asdcplib/src:/Users/carl/Environments/dcpomatic/64/lib
+export DYLD_LIBRARY_PATH=build/src/lib:build/src/wx:build/src/asdcplib/src:/Users/ci/osx-environment/64/lib
 if [ "$1" == "--debug" ]; then
     shift
     gdb --args build/src/tools/dcpomatic2_disk $*
index 92429aa53238c43a75a57bae33328750c895696a..1a3c3d5fe78d4f71f0099aa6b9a1d151850e2ace 100644 (file)
@@ -58,6 +58,13 @@ using namespace boost::placeholders;
 #endif
 
 
+#ifdef DCPOMATIC_OSX
+enum {
+       ID_tools_uninstall = 1,
+};
+#endif
+
+
 class DOMFrame : public wxFrame
 {
 public:
@@ -66,6 +73,15 @@ public:
                , _nanomsg (true)
                , _sizer (new wxBoxSizer(wxVERTICAL))
        {
+#ifdef DCPOMATIC_OSX
+               wxMenuBar* bar = new wxMenuBar;
+               wxMenu* tools = new wxMenu;
+               tools->Append(ID_tools_uninstall, _("Uninstall..."));
+               bar->Append(tools, _("Tools"));
+               SetMenuBar (bar);
+               Bind (wxEVT_MENU, boost::bind(&DOMFrame::uninstall, this), ID_tools_uninstall);
+#endif
+
                /* Use a panel as the only child of the Frame so that we avoid
                   the dark-grey background on Windows.
                */
@@ -163,6 +179,14 @@ private:
        }
 
 
+#ifdef DCPOMATIC_OSX
+       void uninstall()
+       {
+               system(String::compose("osascript \"%1/uninstall_disk.applescript\"", resources_path().string()).c_str());
+       }
+#endif
+
+
        bool should_close ()
        {
                if (!JobManager::instance()->work_to_do()) {
@@ -349,6 +373,7 @@ public:
 #endif
 
 #ifdef DCPOMATIC_OSX
+                       dcpomatic_sleep_seconds (1);
                        make_foreground_application ();
 #endif