Skip to content

Commit

Permalink
Merge pull request #5
Browse files Browse the repository at this point in the history
Symlink bug fix
  • Loading branch information
leonardosahon authored Dec 24, 2023
2 parents 63abf21 + 6b4ceee commit c41aa77
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
6 changes: 5 additions & 1 deletion src/BobDBuilder/Cmd/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,9 +53,13 @@ public function create(): void
// copy helper js file to project lay folder
new LayCopyDir($server->lay_static . "js", $server->shared . "lay");

if($tag == "--fresh-project")
if($tag == "--fresh-project") {
$this->plug->write_info("Fresh project detected!");

// Replace default domain folder on a fresh project
new BobExec("make:domain Default * --silent --force");
}

// create a default domain folder if not exists
if(!is_dir($this->plug->server->domains . "Default"))
new BobExec("make:domain Default * --silent");
Expand Down
17 changes: 7 additions & 10 deletions src/BobDBuilder/Cmd/Traits/Symlink/Dir.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,14 @@ private function dir(): void
. "You cannot link a directory that doesn't exist"
);

if (is_dir($dest)) {
if (!$this->plug->force)
$this->plug->write_warn(
"Destination directory: *$dest* exists already!\n"
. "If you want to REPLACE!! it, pass the flag *--force*\n"
. "***### Take Note:: You will be deleting the former directory if you decide to pass the flag --force"
);

unlink($dest);
}
if (is_dir($dest) && !$this->plug->force)
$this->plug->write_warn(
"Destination directory: *$dest* exists already!\n"
. "If you want to REPLACE!! it, pass the flag *--force*\n"
. "***### Take Note:: You will be deleting the former directory if you decide to pass the flag --force"
);

unlink($dest);
symlink($src, $dest);

$this->plug->write_success(
Expand Down
19 changes: 8 additions & 11 deletions src/BobDBuilder/Cmd/Traits/Symlink/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,14 @@ private function file(): void
if (!file_exists($src))
$this->plug->write_fail("Source file *$src* does not exist! You cannot link a file that doesn't exist");

if (file_exists($dest)) {
if (!$this->plug->force)
$this->plug->write_warn(
"Destination file: *$dest* exists already!\n"
. "If you want to REPLACE!! it, pass the flag *--force*\n"
. "***### Take Note:: You will be deleting the former file if you decide to pass the flag --force"
);

unlink($dest);
}

if (file_exists($dest) && !$this->plug->force)
$this->plug->write_warn(
"Destination file: *$dest* exists already!\n"
. "If you want to REPLACE!! it, pass the flag *--force*\n"
. "***### Take Note:: You will be deleting the former file if you decide to pass the flag --force"
);

unlink($dest);
symlink($src, $dest);

$this->plug->write_success(
Expand Down

0 comments on commit c41aa77

Please sign in to comment.