Kaydet (Commit) 5c1d2297 authored tarafından Guido van Rossum's avatar Guido van Rossum

Instead of 'import mac', use 'import os' -- this way, the path syntax

manipulation routines can be used on non-Mac platforms (e.g. to
manipulate pathnames in a Mac specific archive).
üst 69f65801
# module 'macpath' -- pathname (or -related) operations for the Macintosh # module 'macpath' -- pathname (or -related) operations for the Macintosh
import string import string
import mac import os
from stat import * from stat import *
...@@ -93,8 +93,8 @@ def basename(s): return split(s)[1] ...@@ -93,8 +93,8 @@ def basename(s): return split(s)[1]
def isdir(s): def isdir(s):
try: try:
st = mac.stat(s) st = os.stat(s)
except mac.error: except os.error:
return 0 return 0
return S_ISDIR(st[ST_MODE]) return S_ISDIR(st[ST_MODE])
...@@ -110,8 +110,8 @@ def islink(s): ...@@ -110,8 +110,8 @@ def islink(s):
def isfile(s): def isfile(s):
try: try:
st = mac.stat(s) st = os.stat(s)
except mac.error: except os.error:
return 0 return 0
return S_ISREG(st[ST_MODE]) return S_ISREG(st[ST_MODE])
...@@ -120,8 +120,8 @@ def isfile(s): ...@@ -120,8 +120,8 @@ def isfile(s):
def exists(s): def exists(s):
try: try:
st = mac.stat(s) st = os.stat(s)
except mac.error: except os.error:
return 0 return 0
return 1 return 1
...@@ -186,8 +186,8 @@ def normpath(s): ...@@ -186,8 +186,8 @@ def normpath(s):
def walk(top, func, arg): def walk(top, func, arg):
try: try:
names = mac.listdir(top) names = os.listdir(top)
except mac.error: except os.error:
return return
func(arg, top, names) func(arg, top, names)
for name in names: for name in names:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment