Skip to content

Commit

Permalink
Work around scoop.
Browse files Browse the repository at this point in the history
Scoop tries to control app versions and updates.  But it makes
assumptions which are inaccurate for some apps (such as Clink).

Fine.  Clink will try to work around that by getting the path that was
used to invoke Clink, rather than the path where Clink actually exists.
This ends up getting scoop's "current" directory symlink for the app,
instead of the real "version" directory of the app.

It looks like this shouldn't cause any regressions.

Related to issue #615.
  • Loading branch information
chrisant996 committed Jun 9, 2024
1 parent 626c80e commit 549da72
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions clink/app/src/loader/inject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,9 @@ static void copy_dll(str_base& dll_path)
target_path << "\\" CLINK_DLL;

#if !defined(CLINK_FINAL)
// The DLL id only changes on a commit-premake cycle. During development this
// doesn't work so well so we'll force it through. TODO: check timestamps
// The DLL id only changes on a commit-premake cycle. During development
// this doesn't work so well so we'll force it through.
// TODO: check timestamps and only force when timestamp differs.
bool always = true;
#else
bool always = false;
Expand Down Expand Up @@ -235,9 +236,14 @@ struct wait_monitor : public process_wait_callback
//------------------------------------------------------------------------------
static remote_result inject_dll(DWORD target_pid, bool is_autorun, bool force_host=false)
{
// Get path to clink's DLL that we'll inject.
// Get path to clink's DLL that we'll inject. Using _pgmptr favors the
// path that was actually uses to spawn the clink process. This works
// around the fact that scoop tries to control app versions and updates
// (but scoop can't quite do it correctly if an app has its own updater).
str<280> dll_path;
process().get_file_name(dll_path);
dll_path = _pgmptr;
if (dll_path.empty() || !strpbrk(dll_path.c_str(), "/\\"))
process().get_file_name(dll_path);
path::get_directory(dll_path);
path::append(dll_path, CLINK_DLL);

Expand Down

0 comments on commit 549da72

Please sign in to comment.