Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Write invalid remapped paths to unit files #41

Merged
merged 1 commit into from
Dec 8, 2019

Conversation

kastiglione
Copy link
Contributor

@kastiglione kastiglione commented Dec 8, 2019

When using FileManager::getFile(), if the path does not exist, then the unit file will contain a blank path for that field. Using getVirtualFile() will ensure that even invalid paths are written into the unit file. Invalid paths are useful for two reasons:

  1. The file may not exist now but is expected to exist later
  2. Debugging path remapping in the output of index-import (via absolute-unit)

In the second case, it's better to see an invalid path than an empty path.

The solution should be to use getVirtualFile() everywhere, but this function asserts if called with an empty path (which can legitimately happen[1]). The final solution is to call getVirtualFile in all cases except for the empty string which requires getFile.

  1. For example, .pcm files have an empty MainFilePath

@kastiglione kastiglione merged commit 5ed01ac into master Dec 8, 2019
@kastiglione kastiglione deleted the dl/write-invalid-remapped-paths-to-unit-files branch December 9, 2019 17:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants