Пример #1
0
def do_pwd(args):
       if args:
               print 'usage: pwd'
       else:
               print mac.getcwd()
Пример #2
0
# Maintain a cache of listdir(), isdir(), isfile() or exists() outcomes.

import mac
import macpath


# The cache.
# Keys are absolute pathnames;
# values are 0 (nothing), 1 (file) or [...] (dir).
#
cache = {}


# Current working directory.
#
cwd = mac.getcwd()


# Constants.
#
NONE = 0
FILE = 1
LISTTYPE = type([])

def _stat(name):
	name = macpath.cat(cwd, name)
	if cache.has_key(name):
		return cache[name]
	if macpath.isfile(name):
		cache[name] = FILE
		return FILE
Пример #3
0
def reset():
       G.debug = 0
       G.ps1 = '$ '
       G.homedir = mac.getcwd()
       G.commands = mkcmdtab()
       G.aliases = {}
Пример #4
0
	def ResetVariables(interp):
		interp.globals['ps1'] = '$ '
		interp.globals['ps2'] = '> '
		interp.globals['home'] = mac.getcwd()
Пример #5
0
	def PwdCmd(interp, argv):
		if len(argv) > 1:
			raise UsageError, 'usage: pwd'
		else:
			return mac.getcwd()
Пример #6
0
# Maintain a cache of listdir(), isdir(), isfile() or exists() outcomes.

import mac
import macpath


# The cache.
# Keys are absolute pathnames;
# values are 0 (nothing), 1 (file) or [...] (dir).
#
cache = {}


# Current working directory.
#
cwd = mac.getcwd()


# Constants.
#
NONE = 0
FILE = 1
LISTTYPE = type([])

def _stat(name):
       name = macpath.cat(cwd, name)
       if cache.has_key(name):
               return cache[name]
       if macpath.isfile(name):
               cache[name] = FILE
               return FILE
Пример #7
0
 def ResetVariables(interp):
         interp.globals['ps1'] = '$ '
         interp.globals['ps2'] = '> '
         interp.globals['home'] = mac.getcwd()
Пример #8
0
 def PwdCmd(interp, argv):
         if len(argv) > 1:
                 raise UsageError, 'usage: pwd'
         else:
                 return mac.getcwd()