Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include profile name in global cache path #346

Open
mihinator opened this issue Sep 13, 2022 · 3 comments
Open

Include profile name in global cache path #346

mihinator opened this issue Sep 13, 2022 · 3 comments

Comments

@mihinator
Copy link

Description of the Issue

Is it possible to include FTP profile name into global cache path using variables like %HOSTNAME%, %USERNAME% etc ? Something like D:/all_webprojects_folder/%PROFILE_NAME%/ Couldn't find a full list of available variables.

@chcg
Copy link
Collaborator

chcg commented Sep 15, 2022

@mihinator Not via the default path. The replacement happens at

NppFTP/src/FTPCache.cpp

Lines 324 to 349 in 81e2fec

TCHAR* FTPCache::ExpandPath(const TCHAR * path) {
if (!path)
return NULL;
tstring replacestring(path);
if (_ConfigPath) {
replacestring = SU::ReplaceString(replacestring, TEXT("%CONFIGDIR%"), _ConfigPath);
} else {
replacestring = SU::ReplaceString(replacestring, TEXT("%CONFIGDIR%"), TEXT("."));
}
replacestring = SU::ReplaceString(replacestring, TEXT("%USERNAME%"), m_activeUser);
replacestring = SU::ReplaceString(replacestring, TEXT("%HOSTNAME%"), m_activeHost);
tstring port = std::to_wstring(m_activePort);
replacestring = SU::ReplaceString(replacestring, TEXT("%PORT%"), port);
TCHAR * expanded = new TCHAR[MAX_PATH];
BOOL res = PathSearchAndQualify(replacestring.c_str(), expanded, MAX_PATH);
if (res == FALSE) {
delete [] expanded;
return NULL;
}
PathRemoveBackslash(expanded);
//OutMsg("Expanded %T to %T", path, expanded);

Currently supported:
%CONFIGDIR%
%HOSTNAME%
%USERNAME%
%PORT%

, but you could use the profile specific cache setting. See https://ashkulz.github.io/NppFTP/ -> section Cache paths.
Is that sufficient for you needs?

@mihinator
Copy link
Author

It's possible, but not very convenient. The global path is specified once, but profile specific need to be specified for each profile. But thank you for your answer!

@chcg
Copy link
Collaborator

chcg commented Sep 20, 2022

Necessary changes are similar to addition of the port number, see #241

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants