L-A-Marchetti / BOMulus

📑 BOMulus is a Go application with a GTK-based GUI that allows users to compare and analyze BOM files. It provides version control functionality to identify added, deleted, and updated lines between two BOMs.
11 stars 1 forks source link

add xlsx compatibility #71

Closed Octavelscx closed 1 month ago

Octavelscx commented 1 month ago

why not :)

L-A-Marchetti commented 1 month ago

in pkg/gui/drag_and_drop.go i'm checking if the extension is conform, the conform extension is defined in config/config.go the idea is to transform the FILE_EXT string constant into a string array, and fill it with more possible extensions. You'll need to adapt the drag_and_drop.go file, to check every possible extensions.

if strings.ToLower(filepath.Ext(filename)) == config.FILE_EXT {
                // Update the label with the filename
                label.SetText(filepath.Base(filename))
                // Update the XlsmFiles slice
                switch boxIdx {
                case 1:
                    core.XlsmFiles[0].Path = filename
                case 2:
                    core.XlsmFiles[1].Path = filename
                }
                // Reset the button label.
                button.SetLabel(config.INIT_BUTTON_LABEL)
            } else {
                // If not an .xlsm file, update the label with an error message
                label.SetText(config.WRONG_EXT_MSG)
            }