Skip to content

Commit 9533418

Browse files
committed
Fixing making a new file
1 parent 5c3cda6 commit 9533418

17 files changed

+165
-232
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Wails bin directory
2-
build/bin
2+
build
33

44
# Don't save the public folder. It shoud be compiled each time.
55
frontend/dist

app.go

+11-13
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@ package main
33
import (
44
"context"
55
"errors"
6-
"fmt"
7-
clip "github.com/atotto/clipboard"
8-
"github.com/go-git/go-git/v5"
9-
github "github.com/google/go-github/v49/github"
10-
cp "github.com/otiai10/copy"
11-
rt "github.com/wailsapp/wails/v2/pkg/runtime"
126
"io"
137
"io/fs"
148
"io/ioutil"
@@ -19,13 +13,18 @@ import (
1913
"strconv"
2014
"strings"
2115
"time"
16+
17+
clip "github.com/atotto/clipboard"
18+
"github.com/go-git/go-git/v5"
19+
github "github.com/google/go-github/v49/github"
20+
cp "github.com/otiai10/copy"
21+
rt "github.com/wailsapp/wails/v2/pkg/runtime"
2222
)
2323

2424
// App application struct and other structs
2525
type App struct {
2626
ctx context.Context
2727
err string
28-
proc *os.Process
2928
lastRightDir string
3029
lastLeftDir string
3130
Commands []string
@@ -245,7 +244,7 @@ func (b *App) SplitFile(path string) FileParts {
245244
func (b *App) ReadDir(path string) []FileInfo {
246245
b.err = ""
247246
var result []FileInfo
248-
result = make([]FileInfo, 0, 0)
247+
result = make([]FileInfo, 0)
249248
files, err := ioutil.ReadDir(path)
250249
if err != nil {
251250
b.err = err.Error()
@@ -411,13 +410,12 @@ func (b *App) GetOSName() string {
411410
switch os {
412411
case "windows":
413412
result = "windows"
414-
break
415413
case "darwin":
416414
result = "macos"
417415
case "linux":
418416
result = "linux"
419417
default:
420-
result = fmt.Sprintf("%s", os)
418+
result = os
421419
}
422420
return result
423421
}
@@ -428,7 +426,7 @@ func (b *App) GetGitHubThemes() []GitHubRepos {
428426
topics, _, err := client.Search.Repositories(context.Background(), "in:topic modalfilemanager in:topic theme", nil)
429427
if err == nil {
430428
total := *topics.Total
431-
result = make([]GitHubRepos, total, total)
429+
result = make([]GitHubRepos, total)
432430
for i := 0; i < total; i++ {
433431
result[i].ID = *topics.Repositories[i].ID
434432
result[i].Name = *topics.Repositories[i].Name
@@ -448,7 +446,7 @@ func (b *App) GetGitHubScripts() []GitHubRepos {
448446
topics, _, err := client.Search.Repositories(context.Background(), "in:topic modalfilemanager in:topic V2 in:topic extension", nil)
449447
if err == nil {
450448
total := *topics.Total
451-
result = make([]GitHubRepos, total, total)
449+
result = make([]GitHubRepos, total)
452450
for i := 0; i < total; i++ {
453451
result[i].ID = *topics.Repositories[i].ID
454452
result[i].Name = *topics.Repositories[i].Name
@@ -463,7 +461,7 @@ func (b *App) GetGitHubScripts() []GitHubRepos {
463461
}
464462

465463
func (b *App) SearchMatchingDirectories(path string, pat string, max int) []string {
466-
result := make([]string, max, max)
464+
result := make([]string, max)
467465
count := 0
468466
err := filepath.Walk(path, func(path string, info fs.FileInfo, err error) error {
469467
if err == nil && info.IsDir() {

build/darwin/Info.dev.plist

-32
This file was deleted.

build/darwin/Info.plist

-14
This file was deleted.
Binary file not shown.
23 KB
Loading
1.39 MB
Binary file not shown.

frontend/src/components/FileManager.svelte

+8-22
Original file line numberDiff line numberDiff line change
@@ -1612,12 +1612,6 @@
16121612
16131613
function deleteEntries() {
16141614
let entries = getSelectedFiles();
1615-
if (typeof entries !== "undefined" && entries.length === 0) {
1616-
//
1617-
// Get the entry at the current cursor
1618-
//
1619-
entries.push($currentCursor.entry);
1620-
}
16211615
deleteEntriesCommand(entries);
16221616
}
16231617
@@ -1649,13 +1643,6 @@
16491643
function copyEntries() {
16501644
let entries = getSelectedFiles();
16511645
let sel = true;
1652-
if (typeof entries !== "undefined" && entries.length === 0) {
1653-
//
1654-
// Get the entry at the current cursor
1655-
//
1656-
entries.push($currentCursor.entry);
1657-
sel = false;
1658-
}
16591646
let otherPane;
16601647
if ($currentCursor.pane === "left") {
16611648
otherPane = { ...$currentRightFile.entry };
@@ -1791,12 +1778,6 @@
17911778
17921779
function moveEntries() {
17931780
let entries = getSelectedFiles();
1794-
if (typeof entries !== "undefined" && entries.length === 0) {
1795-
//
1796-
// Get the entry at the current cursor
1797-
//
1798-
entries.push($currentCursor.entry);
1799-
}
18001781
let otherPane =
18011782
$currentCursor.pane === "left"
18021783
? $currentRightFile.entry
@@ -2081,9 +2062,11 @@
20812062
//
20822063
// Create the new file.
20832064
//
2084-
let nfile = { ...$currentCursor.entry };
2085-
nfile.name = nfname;
2086-
await $currentCursor.entry.fileSystem.createFile(nfile);
2065+
nfname = await $currentCursor.entry.fileSystem.appendPath(
2066+
$currentCursor.entry.dir,
2067+
nfname
2068+
);
2069+
await $currentCursor.entry.fileSystem.createFile(nfname);
20872070
20882071
//
20892072
// Refresh the file list.
@@ -2229,6 +2212,9 @@
22292212
//
22302213
selected = rightEntries.filter((item) => item.selected === true);
22312214
}
2215+
if (selected.length === 0) {
2216+
selected.push($currentCursor.entry);
2217+
}
22322218
return selected;
22332219
}
22342220

frontend/src/modules/commands.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
// File: commands.js
33
//
44
// Description: This file contains the commands object for dealing with commands that
5-
// SvelteFileManager uses.
5+
// ModalFileManager uses.
66
//
77

8-
var commands = {
8+
const commands = {
99
commandList: [],
1010
lastError: '',
1111
addCommand: function(name, altname, description, command) {
@@ -45,6 +45,7 @@ var commands = {
4545
return commands.commandList.map(item => {
4646
return {
4747
name: item.name,
48+
altname: item.altname,
4849
description: item.description
4950
};
5051
})

frontend/src/modules/extensions.js

+5-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Description: This object contains the extensions used and interacts with them.
55
//
66

7-
var extensions = {
7+
const extensions = {
88
fileSystems: null,
99
commands: null,
1010
extCommandList: [],
@@ -34,16 +34,16 @@ var extensions = {
3434
//
3535
extensions.config = confg;
3636
extensions.localFS = LFS;
37-
var items = await extensions.localFS.readDir(extensions.extensionDir);
38-
for (var i = 0; i < items.length; i++) {
37+
let items = await extensions.localFS.readDir(extensions.extensionDir);
38+
for (let i = 0; i < items.length; i++) {
3939
const extsDir = await extensions.localFS.appendPath(extensions.extensionDir, items[i].Name);
4040
try {
4141
//
4242
// an extension directory. load it!
4343
//
4444
const paramfile = await extensions.localFS.appendPath(extsDir, 'package.json');
4545
if (await extensions.localFS.fileExists(paramfile)) {
46-
var parms = await extensions.localFS.readFile(paramfile);
46+
let parms = await extensions.localFS.readFile(paramfile);
4747
parms = JSON.parse(parms.toString());
4848
if (typeof parms.mfmextension !== 'undefined') {
4949
const extfile = await extensions.localFS.appendPath(extsDir, parms.mfmextension.main);
@@ -158,7 +158,7 @@ var extensions = {
158158
})
159159
},
160160
removeExtension: function(ext) {
161-
var exten = extensions.extensionList.filter(item => item.name === ext)[0];
161+
let exten = extensions.extensionList.filter(item => item.name === ext)[0];
162162
exten.unload();
163163
extensions.extensionList = extensions.extensionList.filter(item => item.name != ext);
164164
},

go.mod

+35-30
Original file line numberDiff line numberDiff line change
@@ -5,73 +5,78 @@ go 1.18
55
require (
66
github.com/atotto/clipboard v0.1.4
77
github.com/gin-contrib/static v0.0.1
8-
github.com/gin-gonic/gin v1.9.0
9-
github.com/go-git/go-git/v5 v5.6.1
8+
github.com/gin-gonic/gin v1.9.1
9+
github.com/go-git/go-git/v5 v5.9.0
1010
github.com/google/go-github/v49 v49.1.0
11-
github.com/otiai10/copy v1.11.0
12-
github.com/wailsapp/wails/v2 v2.4.1
11+
github.com/otiai10/copy v1.14.0
12+
github.com/wailsapp/wails/v2 v2.6.0
1313
)
1414

1515
require (
16+
dario.cat/mergo v1.0.0 // indirect
1617
github.com/Microsoft/go-winio v0.6.1 // indirect
17-
github.com/ProtonMail/go-crypto v0.0.0-20230426101702-58e86b294756 // indirect
18+
github.com/ProtonMail/go-crypto v0.0.0-20230923063757-afb1ddc0824c // indirect
1819
github.com/acomagu/bufpipe v1.0.4 // indirect
1920
github.com/bep/debounce v1.2.1 // indirect
20-
github.com/bytedance/sonic v1.8.8 // indirect
21-
github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 // indirect
22-
github.com/cloudflare/circl v1.3.3 // indirect
21+
github.com/bytedance/sonic v1.10.2 // indirect
22+
github.com/chenzhuoyu/base64x v0.0.0-20230717121745-296ad89f973d // indirect
23+
github.com/chenzhuoyu/iasm v0.9.0 // indirect
24+
github.com/cloudflare/circl v1.3.5 // indirect
25+
github.com/cyphar/filepath-securejoin v0.2.4 // indirect
2326
github.com/emirpasic/gods v1.18.1 // indirect
27+
github.com/gabriel-vasile/mimetype v1.4.3 // indirect
2428
github.com/gin-contrib/sse v0.1.0 // indirect
25-
github.com/go-git/gcfg v1.5.0 // indirect
26-
github.com/go-git/go-billy/v5 v5.4.1 // indirect
27-
github.com/go-ole/go-ole v1.2.6 // indirect
29+
github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect
30+
github.com/go-git/go-billy/v5 v5.5.0 // indirect
31+
github.com/go-ole/go-ole v1.3.0 // indirect
2832
github.com/go-playground/locales v0.14.1 // indirect
2933
github.com/go-playground/universal-translator v0.18.1 // indirect
30-
github.com/go-playground/validator/v10 v10.13.0 // indirect
34+
github.com/go-playground/validator/v10 v10.15.5 // indirect
3135
github.com/goccy/go-json v0.10.2 // indirect
36+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
3237
github.com/google/go-querystring v1.1.0 // indirect
33-
github.com/google/uuid v1.3.0 // indirect
34-
github.com/imdario/mergo v0.3.15 // indirect
38+
github.com/google/uuid v1.3.1 // indirect
3539
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect
3640
github.com/jchv/go-winloader v0.0.0-20210711035445-715c2860da7e // indirect
3741
github.com/json-iterator/go v1.1.12 // indirect
3842
github.com/kevinburke/ssh_config v1.2.0 // indirect
39-
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
40-
github.com/labstack/echo/v4 v4.10.2 // indirect
43+
github.com/klauspost/cpuid/v2 v2.2.5 // indirect
44+
github.com/labstack/echo/v4 v4.11.2 // indirect
4145
github.com/labstack/gommon v0.4.0 // indirect
42-
github.com/leaanthony/go-ansi-parser v1.6.0 // indirect
46+
github.com/leaanthony/go-ansi-parser v1.6.1 // indirect
4347
github.com/leaanthony/gosod v1.0.3 // indirect
4448
github.com/leaanthony/slicer v1.6.0 // indirect
4549
github.com/leodido/go-urn v1.2.4 // indirect
4650
github.com/mattn/go-colorable v0.1.13 // indirect
47-
github.com/mattn/go-isatty v0.0.18 // indirect
51+
github.com/mattn/go-isatty v0.0.20 // indirect
4852
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
4953
github.com/modern-go/reflect2 v1.0.2 // indirect
50-
github.com/pelletier/go-toml/v2 v2.0.7 // indirect
54+
github.com/pelletier/go-toml/v2 v2.1.0 // indirect
5155
github.com/pjbgf/sha1cd v0.3.0 // indirect
5256
github.com/pkg/browser v0.0.0-20210911075715-681adbf594b8 // indirect
5357
github.com/pkg/errors v0.9.1 // indirect
5458
github.com/rivo/uniseg v0.4.4 // indirect
55-
github.com/rogpeppe/go-internal v1.10.0 // indirect
5659
github.com/samber/lo v1.38.1 // indirect
5760
github.com/sergi/go-diff v1.3.1 // indirect
58-
github.com/skeema/knownhosts v1.1.0 // indirect
61+
github.com/skeema/knownhosts v1.2.1 // indirect
5962
github.com/tkrajina/go-reflector v0.5.6 // indirect
6063
github.com/twitchyliquid64/golang-asm v0.15.1 // indirect
6164
github.com/ugorji/go/codec v1.2.11 // indirect
6265
github.com/valyala/bytebufferpool v1.0.0 // indirect
6366
github.com/valyala/fasttemplate v1.2.2 // indirect
67+
github.com/wailsapp/go-webview2 v1.0.9 // indirect
6468
github.com/wailsapp/mimetype v1.4.1 // indirect
6569
github.com/xanzy/ssh-agent v0.3.3 // indirect
66-
golang.org/x/arch v0.3.0 // indirect
67-
golang.org/x/crypto v0.9.0 // indirect
68-
golang.org/x/exp v0.0.0-20230510235704-dd950f8aeaea // indirect
69-
golang.org/x/mod v0.10.0 // indirect
70-
golang.org/x/net v0.10.0 // indirect
71-
golang.org/x/sys v0.8.0 // indirect
72-
golang.org/x/text v0.9.0 // indirect
73-
golang.org/x/tools v0.9.1 // indirect
74-
google.golang.org/protobuf v1.30.0 // indirect
70+
golang.org/x/arch v0.5.0 // indirect
71+
golang.org/x/crypto v0.14.0 // indirect
72+
golang.org/x/exp v0.0.0-20231006140011-7918f672742d // indirect
73+
golang.org/x/mod v0.13.0 // indirect
74+
golang.org/x/net v0.17.0 // indirect
75+
golang.org/x/sync v0.4.0 // indirect
76+
golang.org/x/sys v0.13.0 // indirect
77+
golang.org/x/text v0.13.0 // indirect
78+
golang.org/x/tools v0.14.0 // indirect
79+
google.golang.org/protobuf v1.31.0 // indirect
7580
gopkg.in/warnings.v0 v0.1.2 // indirect
7681
gopkg.in/yaml.v3 v3.0.1 // indirect
7782
)

0 commit comments

Comments
 (0)