From bdb9b2db003c059f40e0a7e62a911f983e561fcf Mon Sep 17 00:00:00 2001 From: Sergey Kalinin Date: Mon, 27 Oct 2025 14:45:30 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=BE=20=D0=BE=D0=BF=D1=80=D0=B5=D0=B4=D0=B5=D0=BB=D0=B5?= =?UTF-8?q?=D0=BD=D0=B8=D0=B5=20=D0=BF=D1=83=D1=82=D0=B8=20=D0=B4=D0=BE=20?= =?UTF-8?q?git=20=D0=B2=20=D0=B7=D0=B0=D0=B2=D0=B8=D1=81=D0=B8=D0=BC=D0=BE?= =?UTF-8?q?=D1=81=D1=82=D0=B8=20=D0=BE=D1=82=20=D0=BF=D0=BB=D0=B0=D1=82?= =?UTF-8?q?=D1=84=D0=BE=D1=80=D0=BC=D1=8B.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/config.tcl | 2 +- lib/git.tcl | 24 +++++++++++++++++++++++- projman.tcl | 3 +++ 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/lib/config.tcl b/lib/config.tcl index 5caef88..88753cc 100644 --- a/lib/config.tcl +++ b/lib/config.tcl @@ -25,7 +25,7 @@ set ::configDefault "\[General\] cfgModifyDate='' searchCommand=/usr/bin/grep searchCommandOptions=-r -n -H -gitCommand=/usr/bin/git +gitCommand= # must return a mime type of file fileTypeCommand=/usr/bin/file fileTypeCommandOptions=-i -b diff --git a/lib/git.tcl b/lib/git.tcl index 0a1897a..daaa59d 100644 --- a/lib/git.tcl +++ b/lib/git.tcl @@ -11,7 +11,29 @@ namespace eval Git { variable gitCommand - + + # Определим путь до команды git в зависимсти от платформы + proc CommandPathSetting {} { + global cfgVariables tcl_platform + if {$cfgVariables(gitCommand) == ""} { + if {$tcl_platform(platform) eq "windows"} { + set cmd {where git} + } else { + set cmd {which git} + } + if {[catch {exec {*}$cmd} git_path]} { + puts "Git не найден в системе" + set cfgVariables(gitCommand) "Git not found" + return + } + set git_path [string trim $git_path] + set first_path [lindex [split $git_path "\n"] 0] + + # puts "Git найден: $first_path" + set cfgVariables(gitCommand) $first_path + } + } + proc GetConfig {option} { global activeProject cfgVariables set confOptions { diff --git a/projman.tcl b/projman.tcl index 3e0cc1f..952ce7a 100755 --- a/projman.tcl +++ b/projman.tcl @@ -112,6 +112,8 @@ puts "Setting the locale... [::msgcat::mclocale]" source [file join $dir(lib) gui.tcl] +Git::CommandPathSetting + # Open the PATH if command line argument has been setting if [info exists opened] { foreach path $opened { @@ -147,3 +149,4 @@ if [info exists opened] { } } } +