mirror of
https://github.com/lukasbestle/projectr.git
synced 2026-10-11 23:10:19 +02:00
Support for $XDG_CONFIG_HOME
This commit is contained in:
+6
-2
@@ -139,8 +139,12 @@ $branch = $matches[1];
|
||||
// Debug
|
||||
echo "Received commit hash \"$commit\" for repository URL \"$url\" (branch \"$branch\").\n";
|
||||
|
||||
// Open ~/.projects and iterate through every project
|
||||
$listPointer = fopen($_SERVER['HOME'] . '/.projects', 'r');
|
||||
// Determine the path to the projects file
|
||||
$xdgProjectsFile = ($_ENV['XDG_CONFIG_HOME'] ?? ($_SERVER['HOME'] . '/.config')) . '/projectr/projects';
|
||||
$projectsFile = is_file($xdgProjectsFile) === true ? $xdgProjectsFile : $_SERVER['HOME'] . '/.projects';
|
||||
|
||||
// Open the projects file and iterate through every project
|
||||
$listPointer = fopen($projectsFile, 'r');
|
||||
$exitCode = 0;
|
||||
while (($project = fgets($listPointer)) !== false) {
|
||||
// Trim whitespace
|
||||
|
||||
Reference in New Issue
Block a user