Kaydet (Commit) 50399ae5 authored tarafından Guido van Rossum's avatar Guido van Rossum

mac -> os (can't this go now dircache is universal?)

üst d9596e3a
# Module 'maccache' # Module 'maccache'
# #
# Maintain a cache of listdir(), isdir(), isfile() or exists() outcomes. # Maintain a cache of listdir(), isdir(), isfile() or exists() outcomes.
# XXX Should merge with module statcache
import mac import os
import macpath
# The cache. # The cache.
...@@ -15,7 +15,7 @@ cache = {} ...@@ -15,7 +15,7 @@ cache = {}
# Current working directory. # Current working directory.
# #
cwd = mac.getcwd() cwd = os.getcwd()
# Constants. # Constants.
...@@ -25,14 +25,14 @@ FILE = 1 ...@@ -25,14 +25,14 @@ FILE = 1
LISTTYPE = type([]) LISTTYPE = type([])
def _stat(name): def _stat(name):
name = macpath.join(cwd, name) name = os.path.join(cwd, name)
if cache.has_key(name): if cache.has_key(name):
return cache[name] return cache[name]
if macpath.isfile(name): if os.path.isfile(name):
cache[name] = FILE cache[name] = FILE
return FILE return FILE
try: try:
list = mac.listdir(name) list = os.listdir(name)
except: except:
cache[name] = NONE cache[name] = NONE
return NONE return NONE
......
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