briacp/plugin-omt-package

Only __DEFAULT__ project folders are packed correctly

Opened this issue · 2 comments

Background

Project folder paths are editable (replacing the __DEFAULT__ value with the actual path to the folder). For example, it's possible to load source files from a custom source folder.

Precondition

  1. Given a project folder at: /home/USER/foo/PROJECT/
  2. The default source folder would be /home/USER/foo/PROJECT/source/

Steps to reproduce

  1. Modify the path of the source folder to, say, /home/USER/bar/source_files/
  2. Pack the project

Expected results

The source folder in the project package contains the files found in /home/USER/bar/source_files/

Actual results

The source folder in the project package contains the files found in /home/USER/foo/PROJECT/source/

Comments

This behaviour could be made optional with a pack-custom-folders=true|false option in the properties file.

  • If the value is true, the files of the external folder are packed and the folder path becomes __DEFAULT__ in the omegat.project file.

  • If the value is false, the current behavior will be maintained: the default folder is packed and the path to the external folder is maintained in the omegat.project file.

Thomas Cordonnier is working on integrating the OMT plugin in OmegaT, so perhaps it would be good to wait until that's done and apply the patch directly in the OmegaT code base rather than in the plugin.

I would be a bit cautious reading and writing outside the project folder. It could be really easy to accidentally replace files on the recipient computer (either maliciously or not), or fail because lack of sufficient access rights, or use a different directory scheme (omt created on linux and imported on windows, etc)