Skip to content

Commit

Permalink
Fix: Resolve main_file path fully during __init__.
Browse files Browse the repository at this point in the history
This helps avoid problems with relative dir issues. For example,
running:

```
tartex -b Path/To/main.tex
```

led to a crash where the bib file path was being resolved incorrectly as
`/whatever/Path/To/Path/To/main.bib` because the input_files() function
is called after a cd to `Path/To` directory already. Resolving the
main_file path fully at initialisation avoids such rel path issues going
forward.
  • Loading branch information
badshah400 committed Feb 13, 2024
1 parent 0a8fdcb commit de2f8df
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/tartex/tartex.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ class TarTeX:
def __init__(self, args):
self.cwd = Path(os.getcwd())
self.args = parse_args(args)
self.main_file = Path(self.args.fname)
self.main_file = Path(self.args.fname).resolve()
if self.main_file.suffix not in [".fls", ".tex"]:
sys.exit("Error: Source filename must be .tex or .fls\nQuitting")

Expand Down

0 comments on commit de2f8df

Please sign in to comment.