diff --git a/src/Components/Database/Installer.php b/src/Components/Database/Installer.php index 698d453f..10a26033 100644 --- a/src/Components/Database/Installer.php +++ b/src/Components/Database/Installer.php @@ -53,7 +53,7 @@ public function install(): void $this->task( 'Creating a default SQLite database', function () { - if (File::exists(database_path('database.sqlite'))) { + if (File::exists($this->app->databasePath('database.sqlite'))) { return false; } @@ -107,13 +107,13 @@ function () { $this->task( 'Creating default database configuration', function () { - if (File::exists(config_path('database.php'))) { + if (File::exists($this->app->configPath('database.php'))) { return false; } return File::copy( self::CONFIG_FILE, - config_path('database.php') + $this->app->configPath('database.php') ); } ); @@ -121,10 +121,13 @@ function () { $this->task( 'Updating .gitignore', function () { - $gitignorePath = base_path('.gitignore'); + $gitignorePath = $this->app->basePath('.gitignore'); if (File::exists($gitignorePath)) { $contents = File::get($gitignorePath); - $neededLine = '/database/database.sqlite'; + $neededLine = strtr($this->app->databasePath('database.sqlite'), [ + $this->app->basePath() => '', + '\\' => '/', + ]); if (! Str::contains($contents, $neededLine)) { File::append($gitignorePath, $neededLine.PHP_EOL); diff --git a/src/Components/Dotenv/Installer.php b/src/Components/Dotenv/Installer.php index 90f2c1d9..3c481dc9 100644 --- a/src/Components/Dotenv/Installer.php +++ b/src/Components/Dotenv/Installer.php @@ -40,8 +40,8 @@ public function install(): void $this->task( 'Creating .env', function () { - if (! File::exists(base_path('.env'))) { - return File::put(base_path('.env'), 'CONSUMER_KEY='); + if (! File::exists($this->app->basePath('.env'))) { + return File::put($this->app->basePath('.env'), 'CONSUMER_KEY='); } return false; @@ -51,8 +51,8 @@ function () { $this->task( 'Creating .env.example', function () { - if (! File::exists(base_path('.env.example'))) { - return File::put(base_path('.env.example'), 'CONSUMER_KEY='); + if (! File::exists($this->app->basePath('.env.example'))) { + return File::put($this->app->basePath('.env.example'), 'CONSUMER_KEY='); } return false; @@ -62,7 +62,7 @@ function () { $this->task( 'Updating .gitignore', function () { - $gitignorePath = base_path('.gitignore'); + $gitignorePath = $this->app->basePath('.gitignore'); if (File::exists($gitignorePath)) { $contents = File::get($gitignorePath); $neededLine = '.env'; diff --git a/src/Components/Log/Installer.php b/src/Components/Log/Installer.php index 85f47a36..ec2af506 100644 --- a/src/Components/Log/Installer.php +++ b/src/Components/Log/Installer.php @@ -46,7 +46,7 @@ public function install(): void $this->task( 'Creating default logging configuration', function () { - if (! File::exists(config_path('logging.php'))) { + if (! File::exists($this->app->configPath('logging.php'))) { return File::copy( static::CONFIG_FILE, $this->app->configPath('logging.php') diff --git a/src/Components/Queue/Installer.php b/src/Components/Queue/Installer.php index 04503297..994e6bcf 100644 --- a/src/Components/Queue/Installer.php +++ b/src/Components/Queue/Installer.php @@ -49,7 +49,7 @@ public function install(): void $this->task( 'Creating default queue configuration', function () { - if (! File::exists(config_path('queue.php'))) { + if (! File::exists($this->app->configPath('queue.php'))) { return File::copy( self::CONFIG_FILE, $this->app->configPath('queue.php') diff --git a/src/Components/Updater/Provider.php b/src/Components/Updater/Provider.php index 22cbace0..d991434d 100644 --- a/src/Components/Updater/Provider.php +++ b/src/Components/Updater/Provider.php @@ -67,7 +67,7 @@ public function register(): void $this->app->singleton(Updater::class, function () use ($build) { $updater = new PharUpdater($build->getPath(), false, PharUpdater::STRATEGY_GITHUB); - $composer = json_decode(file_get_contents(base_path('composer.json')), true); + $composer = json_decode(file_get_contents($this->app->basePath('composer.json')), true); $name = $composer['name']; $strategy = $this->app['config']->get('updater.strategy', GithubStrategy::class); diff --git a/src/Components/View/Installer.php b/src/Components/View/Installer.php index ed920ad8..5c01a11b 100644 --- a/src/Components/View/Installer.php +++ b/src/Components/View/Installer.php @@ -46,8 +46,8 @@ public function install(): void $this->task( 'Creating resources/views folder', function () { - if (! File::exists(base_path('resources/views'))) { - File::makeDirectory(base_path('resources/views'), 0755, true, true); + if (! File::exists($this->app->resourcePath('views'))) { + File::makeDirectory($this->app->resourcePath('views'), 0755, true, true); return true; } @@ -59,7 +59,7 @@ function () { $this->task( 'Creating default view configuration', function () { - if (! File::exists(config_path('view.php'))) { + if (! File::exists($this->app->configPath('view.php'))) { return File::copy( static::CONFIG_FILE, $this->app->configPath('view.php') @@ -73,26 +73,26 @@ function () { $this->task( 'Creating cache storage folder', function () { - if (File::exists(base_path('storage/app/.gitignore')) && - File::exists(base_path('storage/framework/views/.gitignore')) + if (File::exists($this->app->storagePath('app/.gitignore')) && + File::exists($this->app->storagePath('framework/views/.gitignore')) ) { return false; } - if (! File::exists(base_path('storage/app'))) { - File::makeDirectory(base_path('storage/app'), 0755, true, true); + if (! File::exists($this->app->storagePath('app'))) { + File::makeDirectory($this->app->storagePath('app'), 0755, true, true); } - if (! File::exists(base_path('storage/app/.gitignore'))) { - File::append(base_path('storage/app/.gitignore'), "*\n!.gitignore"); + if (! File::exists($this->app->storagePath('app/.gitignore'))) { + File::append($this->app->storagePath('app/.gitignore'), "*\n!.gitignore"); } - if (! File::exists(base_path('storage/framework/views'))) { - File::makeDirectory(base_path('storage/framework/views'), 0755, true, true); + if (! File::exists($this->app->storagePath('framework/views'))) { + File::makeDirectory($this->app->storagePath('framework/views'), 0755, true, true); } - if (! File::exists(base_path('storage/framework/views/.gitignore'))) { - File::append(base_path('storage/framework/views/.gitignore'), "*\n!.gitignore"); + if (! File::exists($this->app->storagePath('framework/views/.gitignore'))) { + File::append($this->app->storagePath('framework/views/.gitignore'), "*\n!.gitignore"); } return true;