Skip to content

Conversation

@jansorg
Copy link
Collaborator

@jansorg jansorg commented Dec 31, 2024

At first, the script's working directory is used to resolve a relative path. Then, the script's parent directory is used. This commit removes duplicated code shared between file.sh and filecache.sh.

  • I've switched the lookup order, _Dbg_dir=('\$cdir' '\$cwd' ) to _Dbg_dir=('\$cwd' '\$cdir' ), because IMHO the current working directory should be looked at first. At runtime, that's what the debuggee does (I suppose)
  • I've changed typeset _Dbg_cdir="${_Dbg_source_file%/*}" to typeset _Dbg_cdir="${_Dbg_init_cwd%/*}" because that seems more suitable to reference the script's location. In dbg-main.sh variable _Dbg_source_file is used in a loop (without a break) and does not seem to refer to the debuggee script passed to bashdb. Because of the missing break, I think it's always set to $DBG_RESTART_FILE when the loop is done.

Supersedes #61

Update: This is breaking other cases, discussed in #63

At first, the script's working directory is used to resolve a relative path. Then, the script's parent directory is used.
This commit removes duplicated code shared between file.sh and filecache.sh.
@jansorg jansorg marked this pull request as draft December 31, 2024 12:13
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