Open GoogleCodeExporter opened 8 years ago
抱歉,這個問題在我的電腦上不能重現,我沒有日文版的環��
�,請問你能不能給我更詳細的信息?
Original comment by byvo...@gmail.com
on 6 Apr 2012 at 4:39
嗯,我很樂意,但是不知道如何提供更詳細的信息……
能不能給我一份debug版本的opencc for
win,或許我能收集到調用棧。
我可以試試看自己在windows上編譯,只是現在我沒有visual
studio……
Original comment by farsee...@gmail.com
on 6 Apr 2012 at 5:56
會不會是 .ini 裏使用了相對路徑?
做rime::simplifier時頗感頭痛的問題。自己帶詞典的話,用絕對�
��徑則不好事先寫定配置文件,用相對路徑吧,詞典查找路徑
是相對於工作目錄而不是相對於 .ini
文件所在目錄的。換一個目錄執行相對路徑失效,就崩潰了��
�…這個程序裏也應改控制一下。
Original comment by chen....@gmail.com
on 11 Apr 2012 at 9:51
的確是相對路徑……明白了,非常感謝!
這裏我在腳本裏目前採用複製到opencc的目錄,輸出之後再複��
�到原始目錄的方法繞過去了……
非常感謝您製作這樣的一個工具,我在嘗試給一個大陸的大��
�的bbs加入自動的繁體/簡體字轉換的能力。
Original comment by farsee...@gmail.com
on 11 Apr 2012 at 10:14
要解決這個問題的話,得opencc進程先打開輸入、輸出、配置��
�件,再chdir到ini所在的路徑,這樣就能用ini文件的相對路徑��
�。
不過這樣就超過了libc的抽象範圍了,不得不引入和OS相關性��
�大的代碼。
Original comment by damage3...@gmail.com
on 16 Nov 2012 at 5:49
另一種辦法:識別出INI裏定義的相對路徑,相對於INI所在目��
�求得DICT的絕對路徑。
Original comment by chen....@gmail.com
on 17 Nov 2012 at 2:10
再一種辦法:提供API追加一組INI和DICT文件的查找路徑,依次�
��找。客戶程序會有用戶自定義轉換字典的需求,例如可能需
要這樣的查找順序
/usr/share/opencc:/usr/share/coolapp/opencc:~/.coolapp/opencc
Original comment by chen....@gmail.com
on 17 Nov 2012 at 3:14
“識別出INI裏定義的相對路徑,相對於INI所在目錄求得DICT的�
��對路徑。”
我後來也想到了這樣,chdir不太好,對整個進程都有副作用。
只不過這樣似乎需要進行“路徑算術”?比如"opencc/"+".."="."
Original comment by damage3...@gmail.com
on 17 Nov 2012 at 4:32
對於UNIX,先排除 /絕對路徑 ;
snprintf() 拼接:dirname(INI文件路徑) "/" DICT相對路徑
調用 realpath(),如果DICT文件存在則可獲得目標路徑
考慮到windows,又有些麻煩。倒是有一批 API 函數
http://msdn.microsoft.com/en-us/library/bb773559%28v=vs.85%29.aspx
用PathIsRelative()、PathCchRemoveFileSpec()、PathCchAppend()
也能解決問題。
像Boost::Filesystem那樣跨平臺的實現方法還真沒找到。
Original comment by chen....@gmail.com
on 18 Nov 2012 at 5:08
我們自己封裝一下應該不難,主要是我們內部的接口如何設��
�,我準備做了。
Original comment by damage3...@gmail.com
on 18 Nov 2012 at 7:27
Original issue reported on code.google.com by
farsee...@gmail.com
on 2 Apr 2012 at 7:15