# if ($env:depotsxml) { if ((test-path $env:depotsxml) -eq $true) { $scriptPath = (gci $env:depotsxml).DirectoryName $libScriptPath = (gci $env:depotsxml).DirectoryName + "\lib\" $libScripts = gci $libScriptPath $userscriptpath = $null if ($libScripts) { "Valid depots.xml environment path found" ("Loading libraries from " + $libScripts.directoryname[0]) foreach ($script in $libScripts) { . $script.fullname } } } else { throw ("Cannot locate " + $env:depotsxml) } } else { try { $scriptPath = (gci depots.xml) } catch { if (gci depots.init.xml) { write-warning "Found the example depots.xml file: depots.init.xml`r`nEdit to reflect your perforce environment, rename to depots.xml, and try initializing p4ps1 again." } else { throw $error[0] } } if ($scriptPath) { $answer = read-host -Prompt ("depots.xml file found in current directory.`r`nSet depotsxml system environment variable to `'" + $scriptPath + "`'?`r`n(y/n)") if ($answer.tolower() -match "y") { try { [Environment]::SetEnvironmentVariable("depotsxml", $scriptPath, "Machine") $env:depotsxml = $scriptPath } catch { write-error ("Could not set environment variable" + $error[0]) break } } else { write-host "Please specify system environment variable `'depotsxml`' so it points to a valid depots.xml file and try again." break } } else { $userscriptpath = read-host -Prompt "Autolocate of depots.xml failed. Please manually specify location of depots.xml`r`nPress enter without any input to abort.`r`n" if (!$userscriptpath) { write-host "Configuration of system environment variable `'depotsxml`' canceled." break } else { try { $scriptPath = (gci $userscriptpath).fullname } catch { write-error ("depots.xml file not found." + $error[0]) } [Environment]::SetEnvironmentVariable("depotsxml", $scriptPath, "Machine") $env:depotsxml = $scriptPath } } write-warning "Please dot load p4ps1.ps1 again to use function collection" }
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#2 | 8412 | Aaron Bockelie | Added check for example depot.xml config. | ||
#1 | 8410 | Aaron Bockelie |
Root checkin, Perforce Powershell wrapper. Still lots of work to be done, namely documentation and deployment tools, for instance, get-help needs work on the majority of these tools. Additionally, the /lib structure needs a little bit of condensation, probably into major groups (depot, userspec, clientspec, group management, and so on) that way function family can exist under each resource. |