Fix cross-platform import/exports of Dbux log files in `importExport.js`
- Dominant language
- JavaScript
- Stars
- 171
- Forks
- 13
- PR merge metrics
- No merged PRs in 30d
Description
Currently, exporting on one machine and importing from another is not going to work when outside `dbux-projects`.
* [x] Fix file paths
* Currently, all file paths in app are resolved via `allApplications.appRoot`.
* That is resolved as `allApplications.appRoot = getProjectManager().config.projectsRoot || getCodeDirectory()`.
* This option seems to ignore the latter, because `projectsRoot` is always set (for now).
* When exporting: first determine if its a built-in project
* → maybe similar to how `_handleNewApplication` does it, which sets the `projectName`, but maybe change to `builtInProjectName`
* If `projectsRoot` is present:
* resolve file paths relative to `projectsRoot`
* If `builtInProjectName` is not present:
* resolve file paths relative to `getAppCommonAncestorPath` instead (e.g. `getAllProgramsByPackage` shows how to use it)
* encode `getAppCommonAncestorPath` to generate a `appPathId` (to identify whether multiple apps are actually all in the same folder)
* When importing:
* if `builtInProjectName` is present, resolve it as usual (`projectsRoot`)
* if not, ask user to input project path (since we cannot guess where a user might store arbitrary code on their machine), and resolve relative to that.
* When importing multiple apps (see `Pathways` part below), first, iterate all **different** `appPathIds` and ask user up front
* fix docs: https://domiii.github.io/dbux/advanced/data-analysis#art-vandelay
* [x] Test it with different workspaces loaded.
* Test w/ applications recorded from `dbux-projects` and also w/ applications NOT from `dbux-projects`
* [x] Also fix `Pathways` import/export to also use above method
Contributor guide
Assessment
This issue has not been assessed yet.