summaryrefslogtreecommitdiff
path: root/fileutils.py
diff options
context:
space:
mode:
authorAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2007-01-15 12:33:06 +0100
committerAdrien Di Mascio <Adrien.DiMascio@logilab.fr>2007-01-15 12:33:06 +0100
commite10ff3cb0119604fe1934314c62ba57d8816b6b6 (patch)
tree9ad291c76ca00532ebe8445a0598693899f36683 /fileutils.py
parent39ae2667173b691c201f753cd31dd8117de2300f (diff)
downloadlogilab-common-e10ff3cb0119604fe1934314c62ba57d8816b6b6.tar.gz
fix MySQL tests and behaviour when host is None
Diffstat (limited to 'fileutils.py')
-rw-r--r--fileutils.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/fileutils.py b/fileutils.py
index 7566a11..9ede37a 100644
--- a/fileutils.py
+++ b/fileutils.py
@@ -28,6 +28,7 @@ import sys
import shutil
import mimetypes
from os.path import isabs, isdir, islink, split, exists, walk, normpath, join
+from os.path import abspath
from os import sep, mkdir, remove, listdir, stat, chmod
from stat import ST_MODE, S_IWRITE
from cStringIO import StringIO
@@ -60,7 +61,18 @@ def first_level_directory(path):
# path was absolute, head is the fs root
return head
+def abspath_listdir(path):
+ """lists path's content using absolute paths
+ >>> os.listdir('/home')
+ ['adim', 'alf', 'arthur', 'auc']
+ >>> abspath_listdir('/home')
+ ['/home/adim', '/home/alf', '/home/arthur', '/home/auc']
+ """
+ path = abspath(path)
+ return [join(path, filename) for filename in listdir(path)]
+
+
def is_binary(filename):
"""return true if filename may be a binary file, according to it's
extension