Skip to content

Commit

Permalink
added folder/directory selection button for GUI mode and added logic …
Browse files Browse the repository at this point in the history
…to ignore itself while processing files - version v1.4.0
  • Loading branch information
rifsxd committed Oct 4, 2024
1 parent d4d4af7 commit 7318e5c
Show file tree
Hide file tree
Showing 7 changed files with 55 additions and 8 deletions.
11 changes: 11 additions & 0 deletions cmd/gui.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,16 @@ func Gui() {
config.Path = path
}

// Button to select a directory
selectFolderButton := widget.NewButton("Select Directory", func() {
dialog.ShowFolderOpen(func(uri fyne.ListableURI, err error) {
if uri != nil {
pathEntry.SetText(uri.Path()) // Set the selected path in the text entry
config.Path = uri.Path() // Update the config with the selected path
}
}, myWindow)
})

// Create a button for the "Verify" operation
verifyButton := widget.NewButton("Verify", func() {
config := &utils.Config{
Expand All @@ -96,6 +106,7 @@ func Gui() {
widget.NewFormItem("Extensions:", ignoreEntry),
widget.NewFormItem("Path:", pathEntry),
),
selectFolderButton, // Add the "Select Directory" button to the UI
)

myWindow.SetContent(content)
Expand Down
8 changes: 4 additions & 4 deletions common/meta/info.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package meta

// Info variables
const Dev = "RifsxD"
const Name = "DVPL_LZ4 CLI TOOL"
const Version = "1.3.0"
const Name = "DVPL_LZ4 CLI/GUI TOOL"
const Version = "1.4.0"
const Repo = "https://github.com/rifsxd/dvpl_lz4"
const Web = "https://rxd-mods.xyz"
const Commit = "10/03/2024"
const Web = "https://rxd-mods.pages.dev/"
const Commit = "04/10/2024"
const Info = "A CLI/GUI Tool Coded In GoLang To Convert WoTB ( Dava ) SmartDLC DVPL File Based On LZ4 High Compression."
30 changes: 30 additions & 0 deletions common/utils/helper.go
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,12 @@ func ProcessFiles(directoryOrFile string, config *Config) (successCount, failure
return 0, 0, 0, err
}

// Get the path of the currently running executable
executablePath, err := os.Executable()
if err != nil {
return 0, 0, 0, err
}

if info.IsDir() {
dirList, err := os.ReadDir(directoryOrFile)
if err != nil {
Expand All @@ -169,6 +175,15 @@ func ProcessFiles(directoryOrFile string, config *Config) (successCount, failure
ignoredCount += ignored
}
} else {
// Check if the file is the executable itself
if directoryOrFile == executablePath {
if config.Verbose {
fmt.Printf("\n%sIgnoring%s own executable file %s\n", colors.YellowColor, colors.ResetColor, directoryOrFile)
}
ignoredCount++
return successCount, failureCount, ignoredCount, nil
}

isDecompression := config.Mode == "decompress" && strings.HasSuffix(directoryOrFile, dvplExtension)
isCompression := config.Mode == "compress" && !strings.HasSuffix(directoryOrFile, dvplExtension)

Expand Down Expand Up @@ -261,6 +276,12 @@ func VerifyDVPLFiles(directoryOrFile string, config *Config) (successCount, fail
return 0, 0, 0, err
}

// Get the path of the currently running executable
executablePath, err := os.Executable()
if err != nil {
return 0, 0, 0, err
}

if info.IsDir() {
dirList, err := os.ReadDir(directoryOrFile)
if err != nil {
Expand All @@ -279,6 +300,15 @@ func VerifyDVPLFiles(directoryOrFile string, config *Config) (successCount, fail
ignoredCount += ignored
}
} else {
// Check if the file is the executable itself
if directoryOrFile == executablePath {
if config.Verbose {
fmt.Printf("\n%sIgnoring%s own executable file %s\n", colors.YellowColor, colors.ResetColor, directoryOrFile)
}
ignoredCount++
return successCount, failureCount, ignoredCount, nil
}

// Ignore non-.dvpl files during verification
if !strings.HasSuffix(directoryOrFile, dvplExtension) {
if config.Verbose {
Expand Down
2 changes: 2 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
require (
fyne.io/systray v1.11.0 // indirect
github.com/BurntSushi/toml v1.4.0 // indirect
github.com/akavel/rsrc v0.10.2 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/fredbi/uri v1.1.0 // indirect
github.com/fsnotify/fsnotify v1.7.0 // indirect
Expand All @@ -24,6 +25,7 @@ require (
github.com/godbus/dbus/v5 v5.1.0 // indirect
github.com/gopherjs/gopherjs v1.17.2 // indirect
github.com/jeandeaual/go-locale v0.0.0-20240223122105-ce5225dcaa49 // indirect
github.com/josephspurrier/goversioninfo v1.4.1 // indirect
github.com/jsummers/gobmp v0.0.0-20230614200233-a9de23ed2e25 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
Expand Down
4 changes: 4 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/toml v1.4.0 h1:kuoIxZQy2WRRk1pttg9asf+WVv6tWQuBNVmK8+nqPr0=
github.com/BurntSushi/toml v1.4.0/go.mod h1:ukJfTF/6rtPPRCnwkur4qwRxa8vTRFBF0uk2lLoLwho=
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/akavel/rsrc v0.10.2 h1:Zxm8V5eI1hW4gGaYsJQUhxpjkENuG91ki8B4zCrvEsw=
github.com/akavel/rsrc v0.10.2/go.mod h1:uLoCtb9J+EyAqh+26kdrTgmzRBFPGOolLWKpdxkKq+c=
github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY=
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY=
Expand Down Expand Up @@ -200,6 +202,8 @@ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/jeandeaual/go-locale v0.0.0-20240223122105-ce5225dcaa49 h1:Po+wkNdMmN+Zj1tDsJQy7mJlPlwGNQd9JZoPjObagf8=
github.com/jeandeaual/go-locale v0.0.0-20240223122105-ce5225dcaa49/go.mod h1:YiutDnxPRLk5DLUFj6Rw4pRBBURZY07GFr54NdV9mQg=
github.com/josephspurrier/goversioninfo v1.4.1 h1:5LvrkP+n0tg91J9yTkoVnt/QgNnrI1t4uSsWjIonrqY=
github.com/josephspurrier/goversioninfo v1.4.1/go.mod h1:JWzv5rKQr+MmW+LvM412ToT/IkYDZjaclF2pKDss8IY=
github.com/json-iterator/go v1.1.11/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
Expand Down
Binary file modified resource.syso
Binary file not shown.
8 changes: 4 additions & 4 deletions versioninfo.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@
"FixedFileInfo": {
"FileVersion": {
"Major": 1,
"Minor": 3,
"Minor": 4,
"Patch": 0,
"Build": 0
},
"ProductVersion": {
"Major": 1,
"Minor": 3,
"Minor": 4,
"Patch": 0,
"Build": 0
},
Expand All @@ -21,8 +21,8 @@
"StringFileInfo": {
"LanguageName": "en-US",
"LegalCopyright": "Copyright © 2024 RXD-MODS",
"FileVersion": "1.3.0.0",
"ProductVersion": "1.3.0.0",
"FileVersion": "1.4.0.0",
"ProductVersion": "1.4.0.0",
"InternalName": "dvpl_tool cli/gui",
"OriginalFilename": "main.go",
"ProductName": "DVPL_TOOL CLI/GUI",
Expand Down

0 comments on commit 7318e5c

Please sign in to comment.