1. Jannis Leidel
  2. transifex-client

Commits

Seraphim Mellos  committed d24f7be

Fixed problem with file paths when file_filter is not set

  • Participants
  • Parent commits 86a8351
  • Branches default

Comments (0)

Files changed (2)

File txclib/project.py

View file
                 fd.close()
 
             if new_translations:
-                trans_dir = os.path.join(self.root, ".tx", resource)
-                if not os.path.exists(trans_dir):
-                    os.mkdir(trans_dir)
-
                 MSG("Pulling translations for resource %s (source: %s)" %
                 (resource, sfile))
                 for lang in new_translations:
-                    local_file = os.path.join(self.root,
-                        re.sub('<lang>', lang, file_filter))
+                    if file_filter:
+                        local_file = relpath(os.path.join(self.root,
+                            re.sub('<lang>', lang, file_filter)), os.curdir)
+                    else:
+                        trans_dir = os.path.join(self.root, ".tx", resource)
+                        if not os.path.exists(trans_dir):
+                            os.mkdir(trans_dir)
+                        local_file = relpath(os.path.join(trans_dir, '%s_translation' %
+                            lang, os.curdir))
 
                     MSG(" -> %s: %s" % (color_text(lang, "RED"), local_file))
                     r = self.do_url_request('pull_file',

File txclib/utils.py

View file
     This process is functioning recursively from the current directory to each 
     one of the ancestors dirs.
     """
+    path = os.path.abspath(path)
     if path == previous:
         return None
     joined = os.path.join(path, ".tx")