Skip to content

Commit

Permalink
support path containing leading "~/"
Browse files Browse the repository at this point in the history
  • Loading branch information
adaptee committed Dec 3, 2010
1 parent 834df41 commit 6977f91
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pinyin-comp
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,15 @@ def stringlize(text):

return text

def expand_leading_tilda(path):
"expand leading ~/ into $HOME"

if path and path[0] == '~':
home = os.environ['HOME']
return os.path.join( home, path[2:])
else:
return path

if __name__ == '__main__':

# chsdir <dirattr> <already_input_part>
Expand All @@ -167,6 +176,7 @@ if __name__ == '__main__':
dironly = sys.argv[1]

path = sys.argv[2].replace("\\","")
path = expand_leading_tilda(path)
path = unicodelize(path)
# support fuzzy pinyin
path = "".join( [ fuzzynize(x) for x in path] )
Expand Down

0 comments on commit 6977f91

Please sign in to comment.