shithub: choc

Download patch

ref: 3175bb59f356145575de1fb1262fc1497cc17483
parent: 05c3023d2b891c2d4361822b439c59e5828eee79
author: Simon Howard <[email protected]>
date: Sun Dec 23 20:08:32 EST 2018

osx: Add menu item to open autoload folder.

--- a/pkg/osx/IWADController.h
+++ b/pkg/osx/IWADController.h
@@ -38,6 +38,7 @@
 - (void) closeConfigWindow: (id)sender;
 - (void) openConfigWindow: (id)sender;
 - (NSString *) getIWADLocation;
+- (NSString *) autoloadPath;
 - (void) awakeFromNib;
 - (BOOL) setDropdownList;
 - (void) setDropdownSelection;
--- a/pkg/osx/IWADController.m
+++ b/pkg/osx/IWADController.m
@@ -350,6 +350,27 @@
     return env;
 }
 
+- (NSString *) autoloadPath
+{
+    NSArray *array = NSSearchPathForDirectoriesInDomains(
+        NSApplicationSupportDirectory, NSUserDomainMask, YES);
+    if ([array count] == 0)
+    {
+        return nil;
+    }
+
+    IWAD selectedIWAD = [self getSelectedIWAD];
+    if (selectedIWAD == NUM_IWAD_TYPES)
+    {
+        return nil;
+    }
+
+    NSString *base = [array objectAtIndex:0];
+    return [NSString pathWithComponents:
+        [NSArray arrayWithObjects: base, @"chocolate-doom", @"autoload",
+                                   IWADFilenames[selectedIWAD], nil]];
+}
+
 // Set the DOOMWADPATH environment variable to contain the path to each
 // of the configured IWAD files.
 
--- a/pkg/osx/LauncherManager.m
+++ b/pkg/osx/LauncherManager.m
@@ -367,6 +367,27 @@
     OpenDocumentation("");
 }
 
+- (void) openAutoload: (id) sender
+{
+    NSFileManager *fm = [NSFileManager defaultManager];
+    NSString *path = [self->iwadController autoloadPath];
+
+    if (path == nil)
+    {
+        return;
+    }
+
+    if (![fm fileExistsAtPath:path])
+    {
+        [fm createDirectoryAtPath:path
+            withIntermediateDirectories:YES
+            attributes:nil
+            error:nil];
+    }
+
+    [[NSWorkspace sharedWorkspace] openFile:path withApplication:@"Finder"];
+}
+
 - (void) awakeFromNib
 {
     [self->launcherWindow setTitle: @PACKAGE_NAME " Launcher"];
--- a/pkg/osx/Resources/launcher.nib/designable.nib
+++ b/pkg/osx/Resources/launcher.nib/designable.nib
@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="11762" systemVersion="16D32" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
+<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="14113" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
     <dependencies>
         <deployment version="1070" identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="11762"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="14113"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <objects>
@@ -23,7 +23,7 @@
                 <rect key="frame" x="0.0" y="0.0" width="532" height="195"/>
                 <autoresizingMask key="autoresizingMask"/>
                 <subviews>
-                    <textField verticalHuggingPriority="750" id="209">
+                    <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="209">
                         <rect key="frame" x="18" y="173" width="360" height="11"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <textFieldCell key="cell" sendsActionOnEndEditing="YES" id="325">
@@ -52,7 +52,7 @@
                         <autoresizingMask key="autoresizingMask"/>
                         <imageCell key="cell" refusesFirstResponder="YES" alignment="left" animates="YES" imageScaling="axesIndependently" image="128x128" id="327"/>
                     </imageView>
-                    <textField verticalHuggingPriority="750" misplaced="YES" id="218">
+                    <textField verticalHuggingPriority="750" misplaced="YES" allowsCharacterPickerTouchBarItem="YES" id="218">
                         <rect key="frame" x="18" y="125" width="350" height="11"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <textFieldCell key="cell" sendsActionOnEndEditing="YES" id="329">
@@ -63,7 +63,7 @@
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                         </textFieldCell>
                     </textField>
-                    <textField verticalHuggingPriority="750" id="219">
+                    <textField verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="219">
                         <rect key="frame" x="20" y="49" width="346" height="68"/>
                         <autoresizingMask key="autoresizingMask"/>
                         <textFieldCell key="cell" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="border" drawsBackground="YES" id="330">
@@ -131,6 +131,11 @@
                                     <action selector="orderFrontStandardAboutPanel:" target="-2" id="142"/>
                                 </connections>
                             </menuItem>
+                            <menuItem title="Command Prompt..." keyEquivalent="t" id="320">
+                                <connections>
+                                    <action selector="openTerminal:" target="206" id="321"/>
+                                </connections>
+                            </menuItem>
                             <menuItem isSeparatorItem="YES" id="196">
                                 <modifierMask key="keyEquivalentModifierMask" command="YES"/>
                             </menuItem>
@@ -139,9 +144,10 @@
                                     <action selector="openConfigWindow:" target="225" id="268"/>
                                 </connections>
                             </menuItem>
-                            <menuItem title="Command Prompt..." keyEquivalent="t" id="320">
+                            <menuItem title="Autoload..." id="N6e-BR-aby">
+                                <modifierMask key="keyEquivalentModifierMask"/>
                                 <connections>
-                                    <action selector="openTerminal:" target="206" id="321"/>
+                                    <action selector="openAutoload:" target="206" id="340"/>
                                 </connections>
                             </menuItem>
                             <menuItem isSeparatorItem="YES" id="143">
@@ -397,7 +403,7 @@
                             </allowedTypes>
                         </pathCell>
                     </pathControl>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="Wgq-Ur-mWw">
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="Wgq-Ur-mWw">
                         <rect key="frame" x="18" y="201" width="204" height="17"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Final Doom: Plutonia Experiment:" id="LaP-df-7lY">
@@ -406,7 +412,7 @@
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                         </textFieldCell>
                     </textField>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="0w5-iR-7C5">
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="0w5-iR-7C5">
                         <rect key="frame" x="178" y="285" width="44" height="17"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Doom:" id="wiP-4D-kso">
@@ -415,7 +421,7 @@
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                         </textFieldCell>
                     </textField>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="kTD-c1-mVC">
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="kTD-c1-mVC">
                         <rect key="frame" x="168" y="257" width="54" height="17"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Doom II:" id="ucj-hk-PmE">
@@ -424,7 +430,7 @@
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                         </textFieldCell>
                     </textField>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="s5l-jK-qkw">
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="s5l-jK-qkw">
                         <rect key="frame" x="55" y="229" width="167" height="17"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Final Doom: TNT: Evilution:" id="LZC-z3-CHF">
@@ -433,7 +439,7 @@
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                         </textFieldCell>
                     </textField>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="2kB-0c-PG2">
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="2kB-0c-PG2">
                         <rect key="frame" x="170" y="173" width="52" height="17"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Heretic:" id="qPW-Co-8Wz">
@@ -442,7 +448,7 @@
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                         </textFieldCell>
                     </textField>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="lI6-dr-25E">
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="lI6-dr-25E">
                         <rect key="frame" x="176" y="145" width="46" height="17"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Hexen:" id="4hb-dZ-XUu">
@@ -451,7 +457,7 @@
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                         </textFieldCell>
                     </textField>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="iDb-XT-j0E">
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="iDb-XT-j0E">
                         <rect key="frame" x="181" y="117" width="41" height="17"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Strife:" id="ecs-y3-DUG">
@@ -460,7 +466,7 @@
                             <color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
                         </textFieldCell>
                     </textField>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="g5t-SY-4aL">
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="g5t-SY-4aL">
                         <rect key="frame" x="143" y="89" width="79" height="17"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Chex Quest:" id="MK2-8j-Xab">
@@ -513,7 +519,7 @@
                             <action selector="openINSTALL:" target="206" id="385"/>
                         </connections>
                     </button>
-                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="2Lv-nA-R1p">
+                    <textField horizontalHuggingPriority="251" verticalHuggingPriority="750" allowsCharacterPickerTouchBarItem="YES" id="2Lv-nA-R1p">
                         <rect key="frame" x="166" y="61" width="56" height="17"/>
                         <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                         <textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="FreeDM:" id="Tjv-BA-EVD">
binary files a/pkg/osx/Resources/launcher.nib/keyedobjects.nib b/pkg/osx/Resources/launcher.nib/keyedobjects.nib differ