fix: handle when dir might be a file path
This commit is contained in:
parent
1672d9f864
commit
e43d3bda6a
1 changed files with 3 additions and 1 deletions
|
|
@ -435,8 +435,10 @@ class IdeProtocolClient(
|
|||
"getRepoName" -> {
|
||||
// Get the current repository name
|
||||
val dir = (data as Map<String, Any>)["dir"] as String
|
||||
val directory = File(dir)
|
||||
val targetDir = if (directory.isFile) directory.parentFile else directory
|
||||
val builder = ProcessBuilder("git", "config", "--get", "remote.origin.url")
|
||||
builder.directory(File(dir))
|
||||
builder.directory(targetDir)
|
||||
var output = "NONE"
|
||||
try {
|
||||
val process = builder.start()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue