Skip to content

Commit

Permalink
fix file save location
Browse files Browse the repository at this point in the history
  • Loading branch information
kpicaza committed Oct 11, 2023
1 parent 3f5bcef commit 2a59fcc
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 20 deletions.
15 changes: 4 additions & 11 deletions app/Listeners/OpenDocumentWindow.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,23 @@
namespace App\Listeners;

use App\Events\DocumentOpened;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Storage;
use Native\Laravel\Dialog;
use Native\Laravel\Facades\Window;

class OpenDocumentWindow
{
/**
* Create the event listener.
*/
public function __construct()
{
//
}

/**
* Handle the event.
*/
public function handle(DocumentOpened $event): void
{
$storagePath = Storage::disk('user_documents')->path('OpenSketch');
Log::debug($storagePath);
/** @var \Native\Laravel\Windows\WindowManager $window */
$window = Window::getFacadeRoot();
$path = Dialog::new()
->title('Open Sketch Book')
->asSheet()
->defaultPath($storagePath)
->open();

if (null === $path) {
Expand Down
9 changes: 2 additions & 7 deletions app/Listeners/StoreDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,17 @@

class StoreDocument
{
/**
* Create the event listener.
*/
public function __construct()
{
//
}

/**
* Handle the event.
*/
public function handle(DocumentSaved $event): void
{
$storagePath = Storage::disk('user_documents')->path('OpenSketch');
$path = Dialog::new()
->title('Save Sketch Book')
->asSheet()
->defaultPath($storagePath)
->save();

if (null === $path) {
Expand Down
8 changes: 7 additions & 1 deletion config/filesystems.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@

'local' => [
'driver' => 'local',
'root' => storage_path('app'),
'root' => '/',
'throw' => false,
],

Expand All @@ -44,6 +44,12 @@
'throw' => false,
],

'user_documents' => [
'driver' => 'local',
'root' => env('NATIVEPHP_DOCUMENTS_PATH' ,''),
'throw' => false,
],

's3' => [
'driver' => 's3',
'key' => env('AWS_ACCESS_KEY_ID'),
Expand Down
6 changes: 5 additions & 1 deletion vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ import laravel from 'laravel-vite-plugin';
export default defineConfig({
plugins: [
laravel({
input: ['resources/css/app.css', 'resources/js/app.ts'],
input: [
'resources/css/app.css',
'resources/js/src/pages/OpenSketch.ts',
'resources/js/src/pages/SketchManager.ts',
],
refresh: true,
}),
],
Expand Down

0 comments on commit 2a59fcc

Please sign in to comment.