diff options
author | Guido van Rossum <guido@python.org> | 2001-03-02 06:43:49 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2001-03-02 06:43:49 (GMT) |
commit | d74fb6b12a9a53ce09648484076c84e727561612 (patch) | |
tree | 1dc433fdc367d5e2e26eef57606c95df8c2c089b /Lib/whichdb.py | |
parent | 4ba3d657efc124a79b24cc9d8160191384d341de (diff) | |
download | cpython-d74fb6b12a9a53ce09648484076c84e727561612.zip cpython-d74fb6b12a9a53ce09648484076c84e727561612.tar.gz cpython-d74fb6b12a9a53ce09648484076c84e727561612.tar.bz2 |
RISCOS changes by dschwertberger.
Diffstat (limited to 'Lib/whichdb.py')
-rw-r--r-- | Lib/whichdb.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/Lib/whichdb.py b/Lib/whichdb.py index 1f12099..fe54cc5 100644 --- a/Lib/whichdb.py +++ b/Lib/whichdb.py @@ -1,5 +1,12 @@ """Guess which db package to use to open a db file.""" +import os + +if os.sep==".": + endsep = "/" +else: + endsep = "." + def whichdb(filename): """Guess which db package to use to open a db file. @@ -17,9 +24,9 @@ def whichdb(filename): # Check for dbm first -- this has a .pag and a .dir file try: - f = open(filename + ".pag", "rb") + f = open(filename + endsep + "pag", "rb") f.close() - f = open(filename + ".dir", "rb") + f = open(filename + endsep + "dir", "rb") f.close() return "dbm" except IOError: @@ -27,9 +34,9 @@ def whichdb(filename): # Check for dumbdbm next -- this has a .dir and and a .dat file try: - f = open(filename + ".dat", "rb") + f = open(filename + endsep + "dat", "rb") f.close() - f = open(filename + ".dir", "rb") + f = open(filename + endsep + "dir", "rb") try: if f.read(1) in ["'", '"']: return "dumbdbm" |