diff --git a/DEVELOP.md b/DEVELOP.md deleted file mode 100644 index d61735f..0000000 --- a/DEVELOP.md +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - -## 开发 - -多语言 - -https://medium.com/lean-localization/ios-localization-tutorial-938231f9f881 - - - -finderSync - -https://developer.apple.com/library/content/documentation/General/Conceptual/ExtensibilityPG/Finder.html - - - -简单的教程 - -https://github.com/DeveloperLx/macOS_Development_Tutorials_translation - - - -App Extension没有权限读~ - -取homeDirectory返回app的沙盒地址,直接写用户地址,报无法读 - -==> appEx默认打开了sandbox,并且无法关闭。把原~/.macnewfile改在app的sandbox的home目录下file:///Users/ch3n/Library/Containers/co.ch3n.MacNewFile.NewFileEx/Data/ - -(关于sandbox) - -https://medium.com/macos-app-development/using-app-sandbox-for-macos-app-9bc90556f9ce - - - -还是没法写 - -在supporting FIles下面的entitlements里面加 - -com.apple.security.temporary-exception.files.home-relative-path.read-write - -https://developer.apple.com/library/content/documentation/Miscellaneous/Reference/EntitlementKeyReference/Chapters/AppSandboxTemporaryExceptionEntitlements.html - - - -Appicon - -https://github.com/kuyawa/AppIcons - - - -App签名 - -http://nixwang.com/2015/01/07/sign-your-mac-app-with-developer-id/ - -https://developer.apple.com/library/content/documentation/IDEs/Conceptual/AppDistributionGuide/DistributingApplicationsOutside/DistributingApplicationsOutside.html - -关键是要交钱688 - -查看签名 - -``` - codesign -dv /Applications/Whatever.app -``` - - - -Release Build - -Choose **Product** -> **Scheme** -> **Edit Scheme**. Change the `Build Configuration` under the `Info` tab. - - - -DMG - -与拖动安装 - -https://github.com/sindresorhus/create-dmg - -手动对DMG进行签名 - -``` -codesign -s --keychain -``` - - - -签名的原理 - -identity是什么 - -https://developer.apple.com/library/content/documentation/Security/Conceptual/CodeSigningGuide/Procedures/Procedures.html#//apple_ref/doc/uid/TP40005929-CH4-SW2 - -https://developer.apple.com/library/content/documentation/Security/Conceptual/CodeSigningGuide/Introduction/Introduction.html - - - -TODO - -Donate 觉得好用,赞助吃鸡 - -Blog link \ No newline at end of file diff --git a/MacNewFile/Base.lproj/Main.storyboard b/MacNewFile/Base.lproj/Main.storyboard index b7b4b7c..ac644f1 100644 --- a/MacNewFile/Base.lproj/Main.storyboard +++ b/MacNewFile/Base.lproj/Main.storyboard @@ -683,11 +683,11 @@ - + - - - - - - - - - + + + + + + + + + @@ -725,7 +725,7 @@ - + diff --git a/MacNewFile/ViewController.swift b/MacNewFile/ViewController.swift index 3d2a9e8..d0577fe 100644 --- a/MacNewFile/ViewController.swift +++ b/MacNewFile/ViewController.swift @@ -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? { diff --git a/NewFileEx/FinderSync.swift b/NewFileEx/FinderSync.swift index 58966bd..5b51728 100644 --- a/NewFileEx/FinderSync.swift +++ b/NewFileEx/FinderSync.swift @@ -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)