1
0
mirror of https://github.com/winscp/winscp.git synced 2026-10-24 02:28:55 +03:00

Preferring AWS configuration file defined using an environment variable over the default one

For some reason we believed the AWS CLI behaved other way around - and maybe it did - but it does not - as of 2.15.36 (same for 2.13.38)

Source commit: 2a424606f8dd281b3a1b98dfbd93be23c2b1a405
This commit is contained in:
Martin Prikryl
2024-04-09 12:48:46 +00:00
parent 6798747e7a
commit bc8880137d

View File

@@ -82,12 +82,14 @@ static void NeedS3Config()
if (S3ConfigFileName.IsEmpty())
{
S3ConfigFileName = GetEnvironmentVariable(AWS_CONFIG_FILE);
UnicodeString ProfilePath = GetShellFolderPath(CSIDL_PROFILE);
UnicodeString DefaultConfigFileName = IncludeTrailingBackslash(ProfilePath) + L".aws\\credentials";
// "aws" cli really prefers the default location over location specified by AWS_CONFIG_FILE
if (FileExists(DefaultConfigFileName))
if (S3ConfigFileName.IsEmpty())
{
S3ConfigFileName = DefaultConfigFileName;
UnicodeString ProfilePath = GetShellFolderPath(CSIDL_PROFILE);
UnicodeString DefaultConfigFileName = IncludeTrailingBackslash(ProfilePath) + L".aws\\credentials";
if (FileExists(DefaultConfigFileName))
{
S3ConfigFileName = DefaultConfigFileName;
}
}
}