Skip to content

Commit 06ac5d1

Browse files
Merge pull request #3 from alexcurylo/feature/filename_formatting
Add naming preferences for generated files. Thank you alexcurylo!
2 parents ce931ee + dcd3981 commit 06ac5d1

File tree

6 files changed

+151
-17
lines changed

6 files changed

+151
-17
lines changed

BuildSettingExtractor/AppDelegate.m

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,10 @@ - (IBAction)handleDroppedFile:(DragFileView *)sender {
6262
// Move to QOS_CLASS_USER_INITIATED when 10.10 is the deployment target
6363
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
6464
BuildSettingExtractor *buildSettingExtractor = [[BuildSettingExtractor alloc] init];
65+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
66+
buildSettingExtractor.sharedConfigName = [defaults stringForKey:TPSOutputFileNameShared];
67+
buildSettingExtractor.projectConfigName = [defaults stringForKey:TPSOutputFileNameProject];
68+
buildSettingExtractor.nameSeparator = [defaults stringForKey:TPSOutputFileNameSeparator];
6569
buildSettingExtractor.includeBuildSettingInfoComments = [[NSUserDefaults standardUserDefaults] boolForKey:TPSIncludeBuildSettingInfoComments];
6670

6771
[buildSettingExtractor extractBuildSettingsFromProject:fileURL toDestinationFolder:destinationURL];
@@ -81,6 +85,9 @@ - (IBAction)presentPreferencesWindow:(id)sender {
8185
}
8286

8387
- (IBAction)dismissPreferencesWindow:(id)sender {
88+
// make sure current edit field gets bound
89+
[self.preferencesWindow makeFirstResponder:nil];
90+
8491
[self.window endSheet:self.preferencesWindow];
8592
}
8693

@@ -144,7 +151,13 @@ - (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication *)sender
144151
}
145152

146153
- (void)applicationDidFinishLaunching:(NSNotification *)notification {
147-
NSDictionary *defaults = @{TPSOpenDirectoryInFinder:@(YES), TPSIncludeBuildSettingInfoComments:@(YES)};
154+
NSDictionary *defaults = @{
155+
TPSOpenDirectoryInFinder:@(YES),
156+
TPSIncludeBuildSettingInfoComments:@(YES),
157+
TPSOutputFileNameShared:BuildSettingExtractor.sharedConfigNameDefault,
158+
TPSOutputFileNameProject:BuildSettingExtractor.projectConfigNameDefault,
159+
TPSOutputFileNameSeparator:BuildSettingExtractor.nameSeparatorDefault,
160+
};
148161
[[NSUserDefaults standardUserDefaults] registerDefaults:defaults];
149162
}
150163

BuildSettingExtractor/Base.lproj/MainMenu.xib

Lines changed: 103 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2-
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="6254" systemVersion="14C109" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
2+
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="7702" systemVersion="14D136" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES">
33
<dependencies>
44
<deployment identifier="macosx"/>
5-
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="6254"/>
5+
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="7702"/>
66
</dependencies>
77
<objects>
88
<customObject id="-2" userLabel="File's Owner" customClass="NSApplication">
@@ -677,7 +677,7 @@
677677
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES" resizable="YES"/>
678678
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
679679
<rect key="contentRect" x="335" y="390" width="436" height="210"/>
680-
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
680+
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
681681
<view key="contentView" id="EiT-Mj-1SZ">
682682
<rect key="frame" x="0.0" y="0.0" width="436" height="210"/>
683683
<autoresizingMask key="autoresizingMask"/>
@@ -715,16 +715,16 @@
715715
<userDefaultsController representsSharedInstance="YES" id="Czo-a1-luY"/>
716716
<window title="Preferences" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" oneShot="NO" releasedWhenClosed="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="Preferences" animationBehavior="default" id="fKt-mn-0WB">
717717
<windowStyleMask key="styleMask" titled="YES" closable="YES" miniaturizable="YES"/>
718-
<rect key="contentRect" x="985" y="795" width="320" height="122"/>
719-
<rect key="screenRect" x="0.0" y="0.0" width="2560" height="1417"/>
720-
<value key="minSize" type="size" width="320" height="122"/>
721-
<value key="maxSize" type="size" width="320" height="122"/>
718+
<rect key="contentRect" x="985" y="795" width="320" height="265"/>
719+
<rect key="screenRect" x="0.0" y="0.0" width="1920" height="1177"/>
720+
<value key="minSize" type="size" width="320" height="265"/>
721+
<value key="maxSize" type="size" width="320" height="265"/>
722722
<view key="contentView" id="1kK-jA-VrG">
723-
<rect key="frame" x="0.0" y="0.0" width="320" height="122"/>
723+
<rect key="frame" x="0.0" y="0.0" width="320" height="265"/>
724724
<autoresizingMask key="autoresizingMask"/>
725725
<subviews>
726726
<button translatesAutoresizingMaskIntoConstraints="NO" id="jJF-zo-xje">
727-
<rect key="frame" x="18" y="86" width="260" height="18"/>
727+
<rect key="frame" x="18" y="229" width="260" height="18"/>
728728
<buttonCell key="cell" type="check" title="Open destination folder when finished " bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="bOl-XK-mYp">
729729
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
730730
<font key="font" metaFont="system"/>
@@ -734,7 +734,7 @@
734734
</connections>
735735
</button>
736736
<button translatesAutoresizingMaskIntoConstraints="NO" id="PO3-kF-2C5">
737-
<rect key="frame" x="18" y="59" width="242" height="18"/>
737+
<rect key="frame" x="18" y="202" width="242" height="18"/>
738738
<buttonCell key="cell" type="check" title="Include build setting info comments" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="Miy-u0-wrI">
739739
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
740740
<font key="font" metaFont="system"/>
@@ -743,6 +743,95 @@
743743
<binding destination="Czo-a1-luY" name="value" keyPath="values.TPSIncludeBuildSettingInfoComments" id="UHb-Q1-xEE"/>
744744
</connections>
745745
</button>
746+
<box autoresizesSubviews="NO" title="Output Filenames" borderType="line" translatesAutoresizingMaskIntoConstraints="NO" id="D53-ZA-yMZ">
747+
<rect key="frame" x="17" y="58" width="286" height="132"/>
748+
<view key="contentView">
749+
<rect key="frame" x="1" y="1" width="284" height="116"/>
750+
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
751+
<subviews>
752+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="pgR-Eo-bSj">
753+
<rect key="frame" x="30" y="86" width="90" height="17"/>
754+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Project name:" id="55p-LX-tEF">
755+
<font key="font" metaFont="system"/>
756+
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
757+
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
758+
</textFieldCell>
759+
</textField>
760+
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="TQC-44-oLj">
761+
<rect key="frame" x="126" y="84" width="141" height="22"/>
762+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="dJU-oN-41s">
763+
<font key="font" metaFont="system"/>
764+
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
765+
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
766+
<connections>
767+
<binding destination="Czo-a1-luY" name="value" keyPath="values.TPSOutputFileNameProject" id="5kc-lr-9mt"/>
768+
</connections>
769+
</textFieldCell>
770+
<connections>
771+
<binding destination="Czo-a1-luY" name="value" keyPath="values.TPSOutputFileNameProject" id="XH0-ns-RBF"/>
772+
</connections>
773+
</textField>
774+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="c24-WP-E9A">
775+
<rect key="frame" x="29" y="54" width="90" height="17"/>
776+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Shared name:" id="3PN-eT-YAf">
777+
<font key="font" metaFont="system"/>
778+
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
779+
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
780+
</textFieldCell>
781+
</textField>
782+
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YO9-cX-mlT">
783+
<rect key="frame" x="125" y="52" width="141" height="22"/>
784+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="d9j-HG-UH4">
785+
<font key="font" metaFont="system"/>
786+
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
787+
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
788+
</textFieldCell>
789+
<connections>
790+
<binding destination="Czo-a1-luY" name="value" keyPath="values.TPSOutputFileNameShared" id="Fbq-Gw-ZPD"/>
791+
</connections>
792+
</textField>
793+
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="e1H-r8-PZJ">
794+
<rect key="frame" x="16" y="20" width="103" height="17"/>
795+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Word separator:" id="Ioq-vO-Qxk">
796+
<font key="font" metaFont="system"/>
797+
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
798+
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
799+
</textFieldCell>
800+
</textField>
801+
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="YBk-cU-i8C">
802+
<rect key="frame" x="126" y="20" width="141" height="22"/>
803+
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="kDQ-0L-kg5">
804+
<font key="font" metaFont="system"/>
805+
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
806+
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
807+
</textFieldCell>
808+
<connections>
809+
<binding destination="Czo-a1-luY" name="value" keyPath="values.TPSOutputFileNameSeparator" id="kC4-be-U04"/>
810+
</connections>
811+
</textField>
812+
</subviews>
813+
</view>
814+
<constraints>
815+
<constraint firstItem="c24-WP-E9A" firstAttribute="baseline" secondItem="YO9-cX-mlT" secondAttribute="baseline" id="0Qd-MA-H0j"/>
816+
<constraint firstItem="e1H-r8-PZJ" firstAttribute="baseline" secondItem="YBk-cU-i8C" secondAttribute="baseline" constant="2" id="0Qj-zm-fY4"/>
817+
<constraint firstItem="YO9-cX-mlT" firstAttribute="trailing" secondItem="TQC-44-oLj" secondAttribute="trailing" constant="-1" id="0SR-I5-7WK"/>
818+
<constraint firstItem="TQC-44-oLj" firstAttribute="baseline" secondItem="pgR-Eo-bSj" secondAttribute="baseline" id="3c7-zm-QP7"/>
819+
<constraint firstItem="YBk-cU-i8C" firstAttribute="width" secondItem="YO9-cX-mlT" secondAttribute="width" id="5Dx-zY-jIo"/>
820+
<constraint firstAttribute="height" constant="128" id="5al-5J-sc7"/>
821+
<constraint firstItem="YO9-cX-mlT" firstAttribute="width" secondItem="TQC-44-oLj" secondAttribute="width" id="6Hd-ey-NCe"/>
822+
<constraint firstItem="TQC-44-oLj" firstAttribute="top" secondItem="D53-ZA-yMZ" secondAttribute="top" constant="25" id="7El-hr-JRE"/>
823+
<constraint firstAttribute="trailing" secondItem="TQC-44-oLj" secondAttribute="trailing" constant="15" id="KhQ-ac-M2K"/>
824+
<constraint firstItem="TQC-44-oLj" firstAttribute="leading" secondItem="pgR-Eo-bSj" secondAttribute="trailing" constant="8" id="LgO-tt-PBC"/>
825+
<constraint firstItem="TQC-44-oLj" firstAttribute="leading" secondItem="D53-ZA-yMZ" secondAttribute="leading" constant="124" id="TBL-Ak-gZJ"/>
826+
<constraint firstItem="c24-WP-E9A" firstAttribute="trailing" secondItem="pgR-Eo-bSj" secondAttribute="trailing" constant="-1" id="VOB-ZI-2YJ"/>
827+
<constraint firstItem="YBk-cU-i8C" firstAttribute="top" secondItem="YO9-cX-mlT" secondAttribute="bottom" constant="10" id="cH3-4L-VJa"/>
828+
<constraint firstItem="YBk-cU-i8C" firstAttribute="trailing" secondItem="YO9-cX-mlT" secondAttribute="trailing" constant="1" id="n0A-Fk-ZGN"/>
829+
<constraint firstItem="e1H-r8-PZJ" firstAttribute="trailing" secondItem="c24-WP-E9A" secondAttribute="trailing" id="nGW-Og-7Ey"/>
830+
<constraint firstItem="YO9-cX-mlT" firstAttribute="top" secondItem="TQC-44-oLj" secondAttribute="bottom" constant="10" id="nOF-Ce-kQB"/>
831+
</constraints>
832+
<color key="borderColor" white="0.0" alpha="0.41999999999999998" colorSpace="calibratedWhite"/>
833+
<color key="fillColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
834+
</box>
746835
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Hfn-iA-xua">
747836
<rect key="frame" x="224" y="13" width="82" height="32"/>
748837
<constraints>
@@ -763,13 +852,16 @@ DQ
763852
<constraints>
764853
<constraint firstAttribute="bottom" secondItem="Hfn-iA-xua" secondAttribute="bottom" constant="20" symbolic="YES" id="4qv-Vd-eta"/>
765854
<constraint firstItem="PO3-kF-2C5" firstAttribute="top" secondItem="jJF-zo-xje" secondAttribute="bottom" constant="13" id="SBZ-jh-KMn"/>
855+
<constraint firstAttribute="trailing" secondItem="D53-ZA-yMZ" secondAttribute="trailing" constant="20" symbolic="YES" id="Sa3-Y2-5hp"/>
856+
<constraint firstItem="D53-ZA-yMZ" firstAttribute="leading" secondItem="PO3-kF-2C5" secondAttribute="leading" id="Sut-si-RXA"/>
766857
<constraint firstItem="jJF-zo-xje" firstAttribute="leading" secondItem="PO3-kF-2C5" secondAttribute="leading" id="Tk0-KE-6NX"/>
858+
<constraint firstItem="D53-ZA-yMZ" firstAttribute="top" secondItem="PO3-kF-2C5" secondAttribute="bottom" constant="14" id="api-Tj-crN"/>
767859
<constraint firstAttribute="trailing" secondItem="Hfn-iA-xua" secondAttribute="trailing" constant="20" symbolic="YES" id="lga-uZ-nGU"/>
768860
<constraint firstItem="jJF-zo-xje" firstAttribute="top" secondItem="1kK-jA-VrG" secondAttribute="top" constant="20" symbolic="YES" id="tW5-wZ-DRa"/>
769861
<constraint firstItem="jJF-zo-xje" firstAttribute="leading" secondItem="1kK-jA-VrG" secondAttribute="leading" constant="20" symbolic="YES" id="tlz-a7-foM"/>
770862
</constraints>
771863
</view>
772-
<point key="canvasLocation" x="196" y="42"/>
864+
<point key="canvasLocation" x="187.5" y="69"/>
773865
</window>
774866
</objects>
775867
</document>

BuildSettingExtractor/BuildSettingExtractor.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,20 @@
1111

1212
@interface BuildSettingExtractor : NSObject
1313

14-
// The name that will be used to name common / shared config files. "Shared" is the default.
14+
// The name that will be used to name common / shared config files.
1515
@property (copy) NSString *sharedConfigName;
16+
// "Shared" is the default.
17+
+ (NSString *)sharedConfigNameDefault;
1618

17-
// The name that will be used to name the project configuration. Default is "Project".
19+
// The name that will be used to name the project configuration.
1820
@property (copy) NSString *projectConfigName;
21+
// "Project" is the default.
22+
+ (NSString *)projectConfigNameDefault;
23+
24+
// The string that will separate filename components.
25+
@property (copy) NSString *nameSeparator;
26+
// "-" hyphen-case is the default.
27+
+ (NSString *)nameSeparatorDefault;
1928

2029
// Should each build setting be commented with title and description, if available.
2130
@property (assign) BOOL includeBuildSettingInfoComments;

0 commit comments

Comments
 (0)