Skip to content
This repository has been archived by the owner on Jun 27, 2020. It is now read-only.

Fix generate snippet crash in Xcode6.3 #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions lib/xcodesnippet/commands/install.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@
say_error "Input file is empty" and abort if @content.empty?

extract_front_matter!

@output_filepath = File.join(USER_XCODE_SNIPPETS_DIRECTORY, @snippet.identifier + ".codesnippet")
@output_file_prefix = case File.extname(@input_filepath)
when ".swift" then "swift-"
when ".m" then "objc-"
when ".mm" then "objcpp-"
else ""
end
@output_filepath = File.join(USER_XCODE_SNIPPETS_DIRECTORY, @output_file_prefix + @snippet.completion_prefix + ".codesnippet")
begin
FileUtils.mkdir_p(USER_XCODE_SNIPPETS_DIRECTORY)

Expand Down Expand Up @@ -60,6 +65,6 @@ def extract_front_matter!
@snippet.completion_scopes = [front_matter["completion-scope"]] || front_matter["completion-scopes"] || "All"
@snippet.identifier = SecureRandom.uuid().upcase
@snippet.is_user_snippet = true
@snippet.version = 0
@snippet.version = 2
end
end