diff --git a/SYM.xcodeproj/project.pbxproj b/SYM.xcodeproj/project.pbxproj index 7b04746..6f5039e 100644 --- a/SYM.xcodeproj/project.pbxproj +++ b/SYM.xcodeproj/project.pbxproj @@ -67,6 +67,7 @@ B59B326F22E0113100013B67 /* MDHouseArrest.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E2F8522D48383003BC45C /* MDHouseArrest.m */; }; B59B327022E0113300013B67 /* MDInstProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = B5B97AEE22DC737900F5DDF2 /* MDInstProxy.m */; }; B59B327122E0113600013B67 /* MDUtil.m in Sources */ = {isa = PBXBuildFile; fileRef = B53E2F7922D4710C003BC45C /* MDUtil.m */; }; + B5AF3E0327A243AC0037AAAD /* template.sh in Resources */ = {isa = PBXBuildFile; fileRef = B5AF3E0227A243AC0037AAAD /* template.sh */; }; B5B97AEF22DC737900F5DDF2 /* MDInstProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = B5B97AEE22DC737900F5DDF2 /* MDInstProxy.m */; }; B5B97AF022DC737900F5DDF2 /* MDInstProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = B5B97AEE22DC737900F5DDF2 /* MDInstProxy.m */; }; B5EC56D227759AE5007EB567 /* ConfigTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = B5EC56D127759AE5007EB567 /* ConfigTests.swift */; }; @@ -171,6 +172,7 @@ B56BAA5523A8ECDB00049491 /* MdfindWrapper.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MdfindWrapper.swift; sourceTree = ""; }; B5847A8C2569419600B674CA /* DeviceContentViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeviceContentViewController.swift; sourceTree = ""; }; B597FE1422DC8A9400BE439A /* FileBrowserViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FileBrowserViewController.swift; sourceTree = ""; }; + B5AF3E0227A243AC0037AAAD /* template.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; name = template.sh; path = SYM/dSYM/template.sh; sourceTree = SOURCE_ROOT; }; B5B97AED22DC737900F5DDF2 /* MDInstProxy.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MDInstProxy.h; sourceTree = ""; }; B5B97AEE22DC737900F5DDF2 /* MDInstProxy.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = MDInstProxy.m; sourceTree = ""; }; B5EC56D127759AE5007EB567 /* ConfigTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ConfigTests.swift; sourceTree = ""; }; @@ -403,6 +405,7 @@ children = ( B56BAA4F23A8E8EB00049491 /* DsymManager.swift */, F49E2D49214BB2D6001A6A88 /* DsymDownloader.swift */, + B5AF3E0227A243AC0037AAAD /* template.sh */, ); path = Dsym; sourceTree = ""; @@ -727,6 +730,7 @@ F40B9DBE2123E32D000DF7C6 /* models.txt in Resources */, F4CD14631D39D323006BAB2B /* Assets.xcassets in Resources */, B5F357B522C5E90C00111FF3 /* Localizable.strings in Resources */, + B5AF3E0327A243AC0037AAAD /* template.sh in Resources */, B56B9B8923A379CE00049491 /* Dsym.storyboard in Resources */, B5F3579322C5C8EF00111FF3 /* Device.storyboard in Resources */, B5F3579822C5CAD400111FF3 /* ScriptImporter.storyboard in Resources */, diff --git a/SYM/Dsym/template.sh b/SYM/Dsym/template.sh new file mode 100644 index 0000000..0278eae --- /dev/null +++ b/SYM/Dsym/template.sh @@ -0,0 +1,27 @@ +#!/bin/bash + +# Download the .dSYM file to wherever you want. +# SYM can find it automatically. + +# Environment variables: +# $1 # original crash file path +# $2 # download directory +# ${APP_NAME} # e.g. im_zorro_sym +# ${UUID} # e.g. E5B0A378-6816-3D90-86FD-2AEF15894A85 +# ${BUNDLE_ID} # e.g. im.zorro.sym +# ${APP_VERSION} # e.g. 212 (1.0.1) + +# Error handling: +# exit 0 # success +# exit 1 # crash not supported +# exit 2 # download failed + +# Examples: +# curl -o $2/${UUID}.zip http://your.server.domain/path/to/${UUID}.zip +# unzip -o "$2/${UUID}.zip" -d "$2/${UUID}" +# for f in "$2/${UUID}/*.dSYM"; do dwarfdump --uuid $f ; done +# + +# Tips: +# - curl progress will be shown in the downlaod progress bar +# - run `dwarfdump --uuid` at the end of the script to output the UUID will speed up the indexing process \ No newline at end of file diff --git a/SYM/UI/DownloadScriptViewController.swift b/SYM/UI/DownloadScriptViewController.swift index d6eb6d5..f4bb6b3 100644 --- a/SYM/UI/DownloadScriptViewController.swift +++ b/SYM/UI/DownloadScriptViewController.swift @@ -56,37 +56,13 @@ class DownloadScriptViewController: NSViewController { } func loadContent() { - let defaultContent = """ - #!/bin/bash - - # Download the .dSYM file to wherever you want. - # SYM can find it immediately. - - # Crash informations - # $1 # original crash file path - # $2 # download directory - # ${APP_NAME} # e.g. im_zorro_sym - # ${UUID} # e.g. E5B0A378-6816-3D90-86FD-2AEF15894A85 - # ${BUNDLE_ID} # e.g. im.zorro.sym - # ${APP_VERSION} # e.g. 212 (1.0.1) - - # Error handling: - # exit 0 # success - # exit 1 # crash not supported - # exit 2 # download failed" - - # Examples: - # curl -o $2/${UUID}.zip http://your.server.domain/path/to/${UUID}.zip - # unzip -o "$2/${UUID}.zip" -d "$2/${UUID}" - # for f in "$2/${UUID}/*.dSYM"; do dwarfdump --uuid $f ; done - # - - """ - let saved = try? String(contentsOf: Config.downloadScriptURL, encoding: .utf8) - if saved != nil && saved!.count > 0 { - self.textView.string = saved! - } else { - self.textView.string = defaultContent + let userImportedScript = try? String(contentsOf: Config.downloadScriptURL, encoding: .utf8) + if userImportedScript == nil && userImportedScript!.lengthOfBytes(using: .utf8) > 0 { + self.textView.string = userImportedScript! + return } + + let template = try! String(contentsOf: Bundle.main.url(forResource: "template", withExtension: "sh")!, encoding: .utf8) + self.textView.string = template } }