Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to select output location #3

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
10 changes: 5 additions & 5 deletions App/Source/main.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,17 +57,17 @@ private func writeFile(_ file: OriginalFile, toPath path: String) throws
}


if CommandLine.argc<2
if CommandLine.argc<3
{
print("Usage: XLIFFix <file>\n")
print("Usage: XLIFFix <output_dir> <file>\n")
exit(1)
}

let args = CommandLine.arguments
let filemgr = FileManager.default
let currentPath = filemgr.currentDirectoryPath
let outputDirectory = CommandLine.arguments[1]

for i in 1..<CommandLine.argc {
for i in 2..<CommandLine.argc {
let fileName = CommandLine.arguments[Int(i)]

guard let data = try? Data(contentsOf: URL(fileURLWithPath: fileName))
Expand All @@ -93,7 +93,7 @@ for i in 1..<CommandLine.argc {
}

let languageFolder = language + ".lproj"
let outputPath = (currentPath as NSString).appendingPathComponent(languageFolder)
let outputPath = (outputDirectory as NSString).appendingPathComponent(languageFolder)

try writeFile(file, toPath: outputPath)
}
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Utility for recreating strings file from XLIFF. Build the command line utility and put it in a convenient place.

Usage:
`XLIFFix path/to/lang.xliff`
`XLIFFix <output_path> <path/to/lang.xliff>`

Creates a `.lproj` at the current location and places the reconstituted strings files from the XLIFF there.

Expand Down