Skip to content

Commit

Permalink
do not set default auth file path when creating a new config struct
Browse files Browse the repository at this point in the history
  • Loading branch information
iychoi committed Sep 27, 2024
1 parent aa1749a commit 57d7ea1
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 11 deletions.
1 change: 0 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,6 @@ type Config struct {
func GetDefaultConfig() *Config {
return &Config{
AuthenticationScheme: AuthenticationSchemeDefault,
AuthenticationFile: GetDefaultPasswordFilePath(),
ClientServerNegotiation: ClientServerNegotiationDefault,
ClientServerPolicy: ClientServerPolicyDefault,
Port: PortDefault,
Expand Down
8 changes: 2 additions & 6 deletions config/icommands.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,9 @@ func (manager *ICommandsEnvironmentManager) SetEnvironmentFilePath(envFilePath s

manager.EnvironmentDirPath = filepath.Dir(envFilePath)
manager.EnvironmentFilePath = envFilePath
manager.SessionFilePath = fmt.Sprintf("%s.%d", manager.EnvironmentFilePath, manager.PPID)
manager.PasswordFilePath = filepath.Join(manager.EnvironmentDirPath, passwordFilenameDefault)

sessionFilePath := fmt.Sprintf("%s.%d", manager.EnvironmentFilePath, manager.PPID)
manager.SessionFilePath = sessionFilePath

manager.Environment.AuthenticationFile = manager.PasswordFilePath
return nil
}
Expand All @@ -168,11 +166,9 @@ func (manager *ICommandsEnvironmentManager) SetEnvironmentDirPath(envDirPath str

manager.EnvironmentDirPath = envDirPath
manager.EnvironmentFilePath = filepath.Join(envDirPath, environmentFilenameDefault)
manager.SessionFilePath = fmt.Sprintf("%s.%d", manager.EnvironmentFilePath, manager.PPID)
manager.PasswordFilePath = filepath.Join(manager.EnvironmentDirPath, passwordFilenameDefault)

sessionFilePath := fmt.Sprintf("%s.%d", manager.EnvironmentFilePath, manager.PPID)
manager.SessionFilePath = sessionFilePath

manager.Environment.AuthenticationFile = manager.PasswordFilePath
return nil
}
Expand Down
8 changes: 4 additions & 4 deletions irods/util/path.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func ExpandHomeDir(path string) (string, error) {
}

if path[0] != '~' {
return path, nil
return filepath.Abs(path)
}

homedir, err := os.UserHomeDir()
Expand All @@ -80,16 +80,16 @@ func ExpandHomeDir(path string) (string, error) {

// resolve "~"
if len(path) == 1 {
return homedir, nil
return filepath.Abs(homedir)
}

// resolve "~/"
if path[1] == '/' {
path = filepath.Join(homedir, path[2:])
return filepath.Clean(path), nil
return filepath.Abs(path)
}

return path, nil
return filepath.Abs(path)
}

// ExistFile checks if file exists
Expand Down

0 comments on commit 57d7ea1

Please sign in to comment.