self.Top.path = '.'
self.Top.srcpath = '.'
self.Top.path_ = os.path.join('.', '')
- self.cwd = self.Top
+ self._cwd = self.Top
def __hash__(self):
self.__setTopLevelDir()
other.__setTopLevelDir()
return cmp(self.__dict__, other.__dict__)
+ def getcwd(self):
+ self.__setTopLevelDir()
+ return self._cwd
+
def __doLookup(self, fsclass, name, directory=None):
"""This method differs from the File and Dir factory methods in
one important way: the meaning of the directory parameter.
directory = self.Top
name = os.path.join(os.path.normpath('./'), name[1:])
elif not directory:
- directory = self.cwd
+ directory = self._cwd
return (name, directory)
def chdir(self, dir):
"""
self.__setTopLevelDir()
if not dir is None:
- self.cwd = dir
+ self._cwd = dir
def Entry(self, name, directory = None):
"""Lookup or create a generic Entry node with the specified name.
val[e] = 'e'
for k, v in val.items():
assert k == os.path.normpath("hash/" + v)
+
+ # Test getcwd()
+ fs = SCons.Node.FS.FS()
+ assert str(fs.getcwd()) == ".", str(fs.getcwd())
+ fs.chdir(fs.Dir('subdir'))
+ assert str(fs.getcwd()) == "subdir", str(fs.getcwd())
+ fs.chdir(fs.Dir('../..'))
+ assert str(fs.getcwd()) == test.workdir, str(fs.getcwd())
#XXX test exists()
def get_contents(self):
env = self.node.env.Dictionary()
try:
- dir = self.node.cwd
+ dir = self.node.getcwd()
except AttributeError:
dir = None
return self.node.builder.get_contents(env = env, dir = dir)