RISCOS changes by dschwertberger.

This commit is contained in:
Guido van Rossum 2001-03-02 06:43:49 +00:00
parent 4ba3d657ef
commit d74fb6b12a
6 changed files with 64 additions and 24 deletions

View file

@ -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"