2014-05-14 14:52:37 +00:00
|
|
|
import os
|
|
|
|
|
|
|
|
|
2014-05-09 20:34:23 +00:00
|
|
|
def normcase(s):
|
|
|
|
return s
|
2014-05-14 14:46:23 +00:00
|
|
|
|
|
|
|
def normpath(s):
|
|
|
|
return s
|
|
|
|
|
|
|
|
def join(*args):
|
|
|
|
# TODO: this is non-compliant
|
|
|
|
return "/".join(args)
|
|
|
|
|
|
|
|
def split(path):
|
|
|
|
if path == "":
|
|
|
|
return ("", "")
|
|
|
|
r = path.rsplit("/", 1)
|
|
|
|
if len(r) == 1:
|
|
|
|
return ("", path)
|
|
|
|
head = r[0] #.rstrip("/")
|
|
|
|
if not head:
|
|
|
|
head = "/"
|
|
|
|
return (head, r[1])
|
2014-05-14 14:52:37 +00:00
|
|
|
|
|
|
|
def exists(path):
|
|
|
|
return os.access(path, os.F_OK)
|
2014-05-14 17:04:44 +00:00
|
|
|
|
|
|
|
# TODO
|
|
|
|
lexists = exists
|
2014-05-14 18:16:13 +00:00
|
|
|
|
|
|
|
def isdir(path):
|
|
|
|
import stat
|
|
|
|
try:
|
|
|
|
mode = os.stat(path)[0]
|
|
|
|
return stat.S_ISDIR(mode)
|
|
|
|
except OSError:
|
|
|
|
return False
|