Skip to content

Commit

Permalink
Automatically move config for upgrade
Browse files Browse the repository at this point in the history
Fixes #635 by detecting if the config directory is in the old location and moving it immediately when running any Valet command.
  • Loading branch information
drbyte committed Sep 19, 2018
1 parent b76bb0d commit b23650c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions cli/includes/helpers.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
define('VALET_SERVER_PATH', realpath(__DIR__ . '/../../server.php'));
define('VALET_STATIC_PREFIX', '41c270e4-5535-4daa-b23e-c269744c2f45');

define('VALET_LEGACY_HOME_PATH', $_SERVER['HOME'].'/.valet');

/**
* Output the given text to the console.
*
Expand Down
7 changes: 7 additions & 0 deletions cli/valet.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@
use function Valet\table;
use function Valet\warning;

/**
* Relocate config dir to ~/.config/valet/ if found in old location.
*/
if (is_dir(VALET_LEGACY_HOME_PATH) && !is_dir(VALET_HOME_PATH)) {
Configuration::createConfigurationDirectory();
}

/**
* Create the application.
*/
Expand Down

0 comments on commit b23650c

Please sign in to comment.