author |
<albertogli@telpin.com.ar> 2005-03-02 18:42:09 UTC |
committer |
<albertogli@telpin.com.ar> 2005-03-02 18:42:09 UTC |
parent | 1e629a87f64593fab90a2c44b3891581da728e64 |
abk | +13 | -0 |
diff --git a/abk b/abk index 383145e..ddca6de 100644 --- a/abk +++ b/abk @@ -157,6 +157,10 @@ class file_info: def copy_file(self, dst): "Copies a file, along with its permissions and ownership." + # create the path to dst if it doesn't exist + make_path(dst) + + # copy accordingly to the file type if self.type == 'r': self.copy_file_reg(dst) elif self.type == 'l': @@ -281,6 +285,15 @@ def force_unlink(path, type): except OSError: pass +def make_path(f): + "If f is 'a/b/c/f', make sure 'a/b/c' exist." + dir = os.path.dirname(f) + try: + os.makedirs(dir) + except OSError: + # it can fail if already exist + pass + # # main #