blob: 6ab9d713b15cf7e2722180a91c20d945c012ee0e [file] [log] [blame]
Nobuaki Sukegawa2de27002015-11-22 01:13:48 +09001import os
2import sys
3
4if sys.version_info[0] == 2:
5 _ENCODE = sys.getfilesystemencoding()
6
7 def path_join(*args):
8 bin_args = map(lambda a: a.decode(_ENCODE), args)
9 return os.path.join(*bin_args).encode(_ENCODE)
10
11 def str_join(s, l):
12 bin_args = map(lambda a: a.decode(_ENCODE), l)
13 b = s.decode(_ENCODE)
14 return b.join(bin_args).encode(_ENCODE)
15
Nobuaki Sukegawaa6ab1f52015-11-28 15:04:39 +090016 logfile_open = open
17
Nobuaki Sukegawa2de27002015-11-22 01:13:48 +090018else:
19
20 path_join = os.path.join
Nobuaki Sukegawaa6ab1f52015-11-28 15:04:39 +090021 str_join = str.join
Nobuaki Sukegawa2de27002015-11-22 01:13:48 +090022
Nobuaki Sukegawaa6ab1f52015-11-28 15:04:39 +090023 def logfile_open(*args):
24 return open(*args, errors='replace')