def makeShadowDirectory(self, fn): '''Make a shadow directory for the **public** fn.''' x = self; path = x.shadowDirName(fn) if not g.os_path_exists(path): # Force the creation of the directories. g.makeAllNonExistentDirectories(path, c=None, force=True) return g.os_path_exists(path) and g.os_path_isdir(path)
def create(self, fn): '''Create the given file with empty contents.''' theDir = g.os_path_dirname(fn) g.makeAllNonExistentDirectories(theDir, c=self.c, force=True, verbose=True) # Make the directories as needed. try: f = open(fn, mode='wb') f.close() g.note('created: %s' % (fn)) except IOError: g.error('can not create: %s' % (fn)) except Exception: g.error('unexpected error creating: %s' % (fn)) g.es_exception()