-
-
Notifications
You must be signed in to change notification settings - Fork 975
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
關於 cli 版的 config 選項的一些建議 #845
Comments
FFmpeg 使用了一個環境變數 |
也遇到了類似的問題 version: opencc 1.1.7
如果 win 版本能夠自動 fallback 到一個默認的參數路徑,比如 |
這裡提供一個方法以便於在 Windows 中使用 儲存下內容為 opencc.ps1 [string] $PROGRAM_FILE_PATH = 'build\bin\opencc.exe'
[string] $CONFIGS_DIR_PATH = 'build\share\opencc'
$newArgs = $args
$index = '-c', '--config' | % {$newArgs.IndexOf($_)} | ? {$_ -ge 0}
if ($index.Count -le 0) {
$newArgs += @('-c')
$newArgs += @('s2tw.json')
}
$index | % {$newArgs[$_+1] = [IO.Path]::Combine($CONFIGS_DIR_PATH, $newArgs[$_+1])}
$input | & $PROGRAM_FILE_PATH @newArgs
exit $LASTEXITCODE 使用 opencc.ps1 PS >$OutputEncoding = New-Object System.Text.UTF8Encoding $False
PS >Get-Content input.txt -Encoding UTF8 | & opencc.ps1 -o output.txt 若想使用 opencc.exe 為命令而不是 opencc.ps1 或 opencc,則可以使用 Win-PS2EXE 將 ps1 檔轉為 exe 格式 希望將來能看到看到從根本解決此問題 |
1.1.8版本加入了 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
在 windows 中使用 opencc 只能通過完整路徑指定 config,否則只能把工作目錄設定到 config 目錄。也就是需要一個放置 config 的固定位置,以避免需要指定 config 的完整路徑的情況。
例如優先使用 opencc.exe 所在目錄下的 config
-c s2t.json
:另外,希望允許使用 base name 指定 config
例如
-c s2t
即-c s2t.json
The text was updated successfully, but these errors were encountered: