Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bf.chen committed Sep 3, 2017
1 parent f32b89e commit 0998b31
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 120 deletions.
105 changes: 0 additions & 105 deletions DEVELOP.md

This file was deleted.

28 changes: 14 additions & 14 deletions MacNewFile/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
Expand Up @@ -683,11 +683,11 @@
<objects>
<viewController id="XfG-lQ-9wD" customClass="ViewController" customModule="MacNewFile" customModuleProvider="target" sceneMemberID="viewController">
<view key="view" wantsLayer="YES" id="m2S-Jp-Qdl">
<rect key="frame" x="0.0" y="0.0" width="480" height="270"/>
<rect key="frame" x="0.0" y="0.0" width="353" height="120"/>
<autoresizingMask key="autoresizingMask"/>
<subviews>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="iiF-YD-nWQ">
<rect key="frame" x="316" y="119" width="105" height="32"/>
<rect key="frame" x="206" y="56" width="105" height="32"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="smallSquare" title="Here" bezelStyle="smallSquare" imagePosition="left" alignment="center" borderStyle="border" inset="2" id="gbo-6V-iBp">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
Expand All @@ -697,26 +697,26 @@
<action selector="onclick:" target="XfG-lQ-9wD" id="NpI-9a-ZlE"/>
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jON-Qe-pqn">
<rect key="frame" x="46" y="126" width="252" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="mini" sendsActionOnEndEditing="YES" alignment="right" title="Put new file's template files to =&gt;" id="RfH-jc-Yur">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="E4W-eN-iLd">
<rect key="frame" x="169" y="19" width="143" height="17"/>
<rect key="frame" x="297" y="5" width="50" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="inline" title="(C) 2017 Major Essense" bezelStyle="inline" alignment="center" borderStyle="border" inset="2" id="Swb-3h-dxq">
<buttonCell key="cell" type="inline" title="Github" bezelStyle="inline" alignment="center" borderStyle="border" inset="2" id="Swb-3h-dxq">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" metaFont="smallSystemBold"/>
</buttonCell>
<connections>
<action selector="showSite:" target="XfG-lQ-9wD" id="Uzr-nM-NLO"/>
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="NO" translatesAutoresizingMaskIntoConstraints="NO" id="jON-Qe-pqn">
<rect key="frame" x="50" y="63" width="150" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" controlSize="mini" sendsActionOnEndEditing="YES" alignment="left" title="Put template files to =&gt;" id="RfH-jc-Yur">
<font key="font" metaFont="system"/>
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
</textFieldCell>
</textField>
</subviews>
</view>
<connections>
Expand All @@ -725,7 +725,7 @@
</viewController>
<customObject id="rPt-NT-nkU" userLabel="First Responder" customClass="NSResponder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="75" y="655"/>
<point key="canvasLocation" x="11.5" y="580"/>
</scene>
</scenes>
</document>
2 changes: 1 addition & 1 deletion MacNewFile/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ViewController: NSViewController {

// Do any additional setup after loading the view.

self.labelMain.stringValue = "PutFileTo".localized
// self.labelMain.stringValue = "PutFileTo".localized
}

override var representedObject: Any? {
Expand Down
16 changes: 16 additions & 0 deletions NewFileEx/FinderSync.swift
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,22 @@ class FinderSync: FIFinderSync {
do {
let directoryContents = try FileManager.default.contentsOfDirectory(atPath: _fullPath.path)
print(directoryContents)

if (directoryContents.count == 0){
print("create init files")
let names = ["new.md", "new.txt"]
for name in names{

let path = _fullPath.appendingPathComponent(name)
do {
try "".write(toFile: path.path, atomically: false, encoding: .utf8)
} catch {
print("add file to \(path) failed : \(error.localizedDescription)")
}
}
}


return directoryContents
} catch let error as NSError {
print(error.localizedDescription)
Expand Down

0 comments on commit 0998b31

Please sign in to comment.