Skip to content

Commit

Permalink
fix: save modal on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
olup committed Jul 23, 2022
1 parent 72357f8 commit b7f6e30
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 41 deletions.
2 changes: 2 additions & 0 deletions app.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package main

import (
"context"
"fmt"
"log"
"os"
"path/filepath"
Expand Down Expand Up @@ -83,6 +84,7 @@ func (a *App) OpenDirectory(title string) string {
}

func (a *App) SaveFile(title string, defaultDirectory string, defaultFileName string) string {
fmt.Println("Select save path - options : ", defaultDirectory, defaultFileName)
path, _ := runtime.SaveFileDialog(a.ctx, runtime.SaveDialogOptions{
Title: title,
DefaultDirectory: defaultDirectory,
Expand Down
5 changes: 0 additions & 5 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
"@types/path-browserify": "^1.0.0",
"framer-motion": "^6.3.16",
"html-react-parser": "^3.0.1",
"path-browserify": "^1.0.1",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-icons": "^4.4.0"
Expand Down
2 changes: 1 addition & 1 deletion frontend/package.json.md5
Original file line number Diff line number Diff line change
@@ -1 +1 @@
75bc4e05f686c2316036012a5bc0e558
343fa6dde60e9fecdd247fa5934cd669
2 changes: 1 addition & 1 deletion frontend/src/components/NewPackModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
MdOutlineInsertDriveFile,
} from "react-icons/md";
import { CreatePack, OpenDirectory, SaveFile } from "../../wailsjs/go/main/App";
import { basename, dirname } from "path-browserify";
import { basename, dirname } from "../utils";

export const NewPackModal = () => {
const { isOpen, onOpen, onClose } = useDisclosure();
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/utils.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export const basename = (path: string) => {
return path.split(/[\\/]/).pop() || "";
};

export const dirname = (path: string) => {
return path.replace(basename(path), "");
};
22 changes: 11 additions & 11 deletions frontend/wailsjs/go/main/App.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,26 @@
import {uuid} from '../models';
import {lunii} from '../models';

export function SaveFile(arg1:string,arg2:string,arg3:string):Promise<string>;
export function OpenDirectory(arg1:string):Promise<string>;

export function ChangePackOrder(arg1:uuid.UUID,arg2:number):Promise<string|Error>;
export function RemovePack(arg1:uuid.UUID):Promise<boolean|Error>;

export function GetDeviceInfos():Promise<lunii.Device>;
export function CheckForUpdate():Promise<boolean>;

export function InstallPack():Promise<string|Error>;
export function CreatePack(arg1:string,arg2:string):Promise<string|Error>;

export function GetDeviceInfos():Promise<lunii.Device>;

export function OpenFile(arg1:string):Promise<string>;

export function RemovePack(arg1:uuid.UUID):Promise<boolean|Error>;
export function SaveFile(arg1:string,arg2:string,arg3:string):Promise<string>;

export function SyncLuniiStoreMetadata(arg1:Array<uuid.UUID>):Promise<string|Error>;

export function SyncStudioMetadata(arg1:Array<uuid.UUID>,arg2:string):Promise<string|Error>;

export function CheckForUpdate():Promise<boolean>;
export function ChangePackOrder(arg1:uuid.UUID,arg2:number):Promise<string|Error>;

export function CreatePack(arg1:string,arg2:string):Promise<string|Error>;
export function InstallPack():Promise<string|Error>;

export function ListPacks():Promise<Array<lunii.Metadata>>;

export function OpenDirectory(arg1:string):Promise<string>;

export function SyncLuniiStoreMetadata(arg1:Array<uuid.UUID>):Promise<string|Error>;
44 changes: 22 additions & 22 deletions frontend/wailsjs/go/main/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,50 +2,50 @@
// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT

export function SaveFile(arg1, arg2, arg3) {
return window['go']['main']['App']['SaveFile'](arg1, arg2, arg3);
export function OpenDirectory(arg1) {
return window['go']['main']['App']['OpenDirectory'](arg1);
}

export function ChangePackOrder(arg1, arg2) {
return window['go']['main']['App']['ChangePackOrder'](arg1, arg2);
export function RemovePack(arg1) {
return window['go']['main']['App']['RemovePack'](arg1);
}

export function GetDeviceInfos() {
return window['go']['main']['App']['GetDeviceInfos']();
export function CheckForUpdate() {
return window['go']['main']['App']['CheckForUpdate']();
}

export function InstallPack() {
return window['go']['main']['App']['InstallPack']();
export function CreatePack(arg1, arg2) {
return window['go']['main']['App']['CreatePack'](arg1, arg2);
}

export function GetDeviceInfos() {
return window['go']['main']['App']['GetDeviceInfos']();
}

export function OpenFile(arg1) {
return window['go']['main']['App']['OpenFile'](arg1);
}

export function RemovePack(arg1) {
return window['go']['main']['App']['RemovePack'](arg1);
export function SaveFile(arg1, arg2, arg3) {
return window['go']['main']['App']['SaveFile'](arg1, arg2, arg3);
}

export function SyncLuniiStoreMetadata(arg1) {
return window['go']['main']['App']['SyncLuniiStoreMetadata'](arg1);
}

export function SyncStudioMetadata(arg1, arg2) {
return window['go']['main']['App']['SyncStudioMetadata'](arg1, arg2);
}

export function CheckForUpdate() {
return window['go']['main']['App']['CheckForUpdate']();
export function ChangePackOrder(arg1, arg2) {
return window['go']['main']['App']['ChangePackOrder'](arg1, arg2);
}

export function CreatePack(arg1, arg2) {
return window['go']['main']['App']['CreatePack'](arg1, arg2);
export function InstallPack() {
return window['go']['main']['App']['InstallPack']();
}

export function ListPacks() {
return window['go']['main']['App']['ListPacks']();
}

export function OpenDirectory(arg1) {
return window['go']['main']['App']['OpenDirectory'](arg1);
}

export function SyncLuniiStoreMetadata(arg1) {
return window['go']['main']['App']['SyncLuniiStoreMetadata'](arg1);
}

0 comments on commit b7f6e30

Please sign in to comment.