Beispiel #1
0
	def commandline(self):
		self._params = ['path']
		path = Path.normalized( getattr(self, "path", None))

		cwd = get_working_directory()
		newpath = Path.absolute(os.path.join(cwd, path))

		push_working_directory(newpath)
		#logging.info("current directory: \"%s\"" % cwd)
		#logging.info("push_directory: %s" % newpath)
		return None
Beispiel #2
0
	def run(self):
		path = Path.normalized( getattr(self, 'path', None))
		if path:
			try:
				path = Path.absolute(os.path.join(get_working_directory(), path))

				# if this path already exists; return False as it wasn't
				# created by this method.
				if os.path.isdir(path):
					return False

				#logging.info( "MAKEDIRS: %s" % path )
				os.makedirs(path)
			except OSError as exc:
				if exc.errno == 20:
					logging.error("Attempted to make a path: \"%s\", but ran into a file with the name of an expected directory." % path)
					logging.error("Check for files that have the same name of the directory you may want to create.")
					raise

				# OSError: [Errno 17] File exists:
				pass
			except:
				raise
		return True