<commit_before>function Set-TCParameters() {
    $pp = Get-PackageParameters
    $localUser   = 'UserName='  + $(if ($pp.LocalUser)   { '' }  else { '*' })
    $desktopIcon = 'mkdesktop=' + $(if ($pp.DesktopIcon) { '1' } else { '0' })
    $installPath = 'Dir='       + $(if ($pp.InstallPath) { $pp.InstallPath } else { '%ProgramFiles%\totalcmd' })

    $installInf = Join-Path $tcmdWork "INSTALL.INF"
    (Get-Content $installInf)   -Replace 'UserName=',        $localUser `
                                -Replace 'auto=0',           'auto=1' `
                                -Replace 'hidden=0',         'hidden=1' `
                                -Replace 'mkdesktop=1',      $desktopIcon `
                                -Replace 'Dir=c:\\totalcmd', $installPath | Set-Content $installInf
}

function Extract-TCFiles() {
    Write-Verbose "Extract EXE to change install options"
    $setupFile = gi $toolsPath\*.exe
    7za x -y "-o$($tcmdWork)" $setupFile
    if ($LastExitCode) { throw "Error executing 7za to unzip totalcmd exe - exit code $LastExitCode." }

    Write-Verbose "Extract installer"
    $instFile  = gi $toolsPath\*.zip
    7za x -y "-o$($tcmdWork)" $instFile
    if ($LastExitCode) { throw "Error executing 7za to unzip totalcmd installer - exit code $LastExitCode." }

    if ($is64) {
        mv $tcmdWork\INSTALL64.exe  $tcmdWork\INSTALL.exe -Force
        mv $tcmdWork\INSTALL64.inf  $tcmdWork\INSTALL.inf -Force
    }
}

function Get-TCInstallLocation() {
    (gp 'HKLM:\SOFTWARE\Ghisler\Total Commander').InstallDir
}

function Set-TCIniFilesLocation() {<commit_msg>(totalcommander) searching in more places to find install location<commit_after>function Set-TCParameters() {
    $pp = Get-PackageParameters
    $localUser   = 'UserName='  + $(if ($pp.LocalUser)   { '' }  else { '*' })
    $desktopIcon = 'mkdesktop=' + $(if ($pp.DesktopIcon) { '1' } else { '0' })
    $installPath = 'Dir='       + $(if ($pp.InstallPath) { $pp.InstallPath } else { '%ProgramFiles%\totalcmd' })

    $installInf = Join-Path $tcmdWork "INSTALL.INF"
    (Get-Content $installInf)   -Replace 'UserName=',        $localUser `
                                -Replace 'auto=0',           'auto=1' `
                                -Replace 'hidden=0',         'hidden=1' `
                                -Replace 'mkdesktop=1',      $desktopIcon `
                                -Replace 'Dir=c:\\totalcmd', $installPath | Set-Content $installInf
}

function Extract-TCFiles() {
    Write-Verbose "Extract EXE to change install options"
    $setupFile = gi $toolsPath\*.exe
    7za x -y "-o$($tcmdWork)" $setupFile
    if ($LastExitCode) { throw "Error executing 7za to unzip totalcmd exe - exit code $LastExitCode." }

    Write-Verbose "Extract installer"
    $instFile  = gi $toolsPath\*.zip
    7za x -y "-o$($tcmdWork)" $instFile
    if ($LastExitCode) { throw "Error executing 7za to unzip totalcmd installer - exit code $LastExitCode." }

    if ($is64) {
        mv $tcmdWork\INSTALL64.exe  $tcmdWork\INSTALL.exe -Force
        mv $tcmdWork\INSTALL64.inf  $tcmdWork\INSTALL.inf -Force
    }
}

function Get-TCInstallLocation() {
    if ($Env:COMMANDER_PATH) { return $Env:COMMANDER_PATH }

    $key = gp 'HKLM:\SOFTWARE\Ghisler\Total Commander' -ea 0
    if ($key) { return $key.InstallDir }

    $installLocation = Get-AppInstallLocation totalcmd
    if ($installLocation) { return $installLocation }

    if (Test-Path c:\totalcmd) { return "c:\totalcmd" }
}

function Set-TCIniFilesLocation() {
{'fraction_non_alphanumeric': 0.14184195565662308, 'fraction_numerical': 0.009948834565093803, 'mean_word_length': 2.456777996070727, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2355076', 'n_tokens_mistral': 1178, 'n_tokens_neox': 1104, 'n_words': 265}