improving windows compatability
This commit is contained in:
parent
921540d5a4
commit
8de4db960a
6 changed files with 73 additions and 107 deletions
|
@ -26,16 +26,24 @@ type Config struct {
|
|||
func LoadConfig() (*Config, error) {
|
||||
file, err := os.Open("sourceforge_config.json") // Assuming a JSON config file
|
||||
if err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("failed to open config file: %v", err)
|
||||
}
|
||||
defer file.Close()
|
||||
|
||||
config := &Config{}
|
||||
if err := json.NewDecoder(file).Decode(config); err != nil {
|
||||
return nil, err
|
||||
return nil, fmt.Errorf("failed to decode config file: %v", err)
|
||||
}
|
||||
|
||||
config.SFKeyPath = filepath.FromSlash(config.SFKeyPath)
|
||||
// Normalize the SSH key path for the current OS
|
||||
config.SFKeyPath = filepath.Clean(config.SFKeyPath)
|
||||
|
||||
// Validate that the key file exists
|
||||
if _, err := os.Stat(config.SFKeyPath); os.IsNotExist(err) {
|
||||
return nil, fmt.Errorf("SSH key file not found at path: %s", config.SFKeyPath)
|
||||
} else if err != nil {
|
||||
return nil, fmt.Errorf("error accessing SSH key file: %v", err)
|
||||
}
|
||||
|
||||
return config, nil
|
||||
}
|
||||
|
@ -74,7 +82,9 @@ func CompressDirectory(srcDir, dstFile string) error {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
header.Name = relPath
|
||||
|
||||
// Normalize paths to UNIX-style for tar compatibility
|
||||
header.Name = filepath.ToSlash(relPath)
|
||||
|
||||
// Explicitly set the type flag for directories
|
||||
if fi.IsDir() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue