Skip to content

Commit ee0285a

Browse files
committed
HelpFile can be a URL
1 parent 99aa902 commit ee0285a

File tree

4 files changed

+36
-22
lines changed

4 files changed

+36
-22
lines changed

NppExec/src/NppExec.cpp

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -4100,35 +4100,39 @@ void CNppExec::OnHelpManual()
41004100
}
41014101
}
41024102

4103-
sHelpFile.Replace( _T('/'), _T('\\') );
4104-
if ( NppExecHelpers::IsFullPath(sHelpFile) )
4103+
const bool isURL = (sHelpFile.Find(_T("://")) > 0);
4104+
if ( !isURL )
41054105
{
4106-
if ( !NppExecHelpers::CheckFileExists(sHelpFile) )
4107-
return; // file does not exist, nothing to do
4108-
}
4109-
else
4110-
{
4111-
// sHelpFile is a relative pathname
4112-
if ( sHelpFile.GetFirstChar() == _T('\\') )
4113-
sHelpFile.DeleteFirstChar();
4114-
4115-
// first, trying the folder at the level of NppExec.dll
4116-
tstr sHelpFilePath = getPluginDllPath();
4117-
sHelpFilePath += _T('\\');
4118-
sHelpFilePath += sHelpFile;
4119-
if ( !NppExecHelpers::CheckFileExists(sHelpFilePath) )
4106+
sHelpFile.Replace( _T('/'), _T('\\') );
4107+
if ( NppExecHelpers::IsFullPath(sHelpFile) )
4108+
{
4109+
if ( !NppExecHelpers::CheckFileExists(sHelpFile) )
4110+
return; // file does not exist, nothing to do
4111+
}
4112+
else
41204113
{
4121-
// then, trying the folder one level upper
4122-
sHelpFilePath = NppExecHelpers::GetFileNamePart(getPluginDllPath(), NppExecHelpers::fnpDirPath);
4114+
// sHelpFile is a relative pathname
4115+
if ( sHelpFile.GetFirstChar() == _T('\\') )
4116+
sHelpFile.DeleteFirstChar();
4117+
4118+
// first, trying the folder at the level of NppExec.dll
4119+
tstr sHelpFilePath = getPluginDllPath();
4120+
sHelpFilePath += _T('\\');
41234121
sHelpFilePath += sHelpFile;
41244122
if ( !NppExecHelpers::CheckFileExists(sHelpFilePath) )
4125-
return; // file does not exist, nothing to do
4123+
{
4124+
// then, trying the folder one level upper
4125+
sHelpFilePath = NppExecHelpers::GetFileNamePart(getPluginDllPath(), NppExecHelpers::fnpDirPath);
4126+
sHelpFilePath += sHelpFile;
4127+
if ( !NppExecHelpers::CheckFileExists(sHelpFilePath) )
4128+
return; // file does not exist, nothing to do
4129+
}
4130+
sHelpFile.Swap(sHelpFilePath);
41264131
}
4127-
sHelpFile.Swap(sHelpFilePath);
41284132
}
4129-
4133+
41304134
#ifndef __MINGW32__
4131-
if ( sHelpFile.Find(_T(".chm")) > 0 )
4135+
if ( sHelpFile.Find(_T(".chm")) > 0 && !isURL )
41324136
::HtmlHelp( NULL, sHelpFile.c_str(), HH_DISPLAY_TOPIC, NULL );
41334137
else
41344138
#endif

NppExec/src/NppExec.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
2828
+ handling the "-pluginMessage" command-line arguments
2929
+ new environment variable: $(NPP_SETTINGS_DIR)
3030
+ updated: now echo~ supports both math and string expressions
31+
+ updated: HelpFile can be a URL (see "NppExec_TechInfo.txt")
3132
+ NppExec Manual updated
3233
* npp_files updated to Notepad++ 8.8.6
3334

docs/NppExec.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,7 @@
255255
+ handling the "-pluginMessage" command-line arguments
256256
+ new environment variable: $(NPP_SETTINGS_DIR)
257257
+ updated: now echo~ supports both math and string expressions
258+
+ updated: HelpFile can be a URL (see "NppExec_TechInfo.txt")
258259
+ NppExec Manual updated
259260
* npp_files updated to Notepad++ 8.8.6
260261

docs/NppExec_TechInfo.txt

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -720,6 +720,14 @@
720720
$(SYS.TEMP)
721721
$(NPP_DIRECTORY)
722722
$(PLUGINS_CONFIG_DIR)
723+
This can also be a URL that points to the online version of the Manual:
724+
HelpFile=https://d0vgan.github.io/nppexec/
725+
To start with a specific topic of the online Manual, use "?q=", such as:
726+
HelpFile=https://d0vgan.github.io/nppexec/?q=FAQ
727+
or:
728+
HelpFile=https://d0vgan.github.io/nppexec/?q=4.0
729+
This can also be a path to the local HTML version of the Manual, e.g.:
730+
HelpFile=C:\github\nppexec\docs\index.html
723731

724732

725733
TempScriptFile

0 commit comments

Comments
 (0)