Skip to content

Commit

Permalink
@mlehenb: Add getCurrentFileDirectory() and use it in launchGit() and…
Browse files Browse the repository at this point in the history
… gitPrompt
  • Loading branch information
Vince committed Jan 8, 2021
2 parents 6b88e7a + 5956fea commit f9b4f26
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
22 changes: 16 additions & 6 deletions PluginDefinition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,6 +221,20 @@ std::wstring getCurrentFile()
return std::wstring( path );
}

///
/// Gets the path to the current file's directory.
///
/// @return Current file's directory path.
///
std::wstring getCurrentFileDirectory()
{
TCHAR path[MAX_PATH];
::SendMessage(nppData._nppHandle, NPPM_GETCURRENTDIRECTORY, MAX_PATH,
(LPARAM)path);

return std::wstring(path);
}

///
/// Gets the path to the TortioseGit executable from the registry.
///
Expand Down Expand Up @@ -291,7 +305,7 @@ bool launchGit( std::wstring &command )
FALSE,
CREATE_DEFAULT_ERROR_MODE,
NULL,
NULL,
const_cast<LPCWSTR>( getCurrentFileDirectory().c_str() ),
&si,
&pi ) != 0;
}
Expand Down Expand Up @@ -408,11 +422,7 @@ void gitPrompt()
if ( _gitPanel.isVisible() )
updateLoc( pathName );
else
{
TCHAR tempPath[MAX_PATH] = {0};
SendMessage( nppData._nppHandle, NPPM_GETCURRENTDIRECTORY, MAX_PATH, ( LPARAM )tempPath );
pathName = tempPath;
}
pathName = getCurrentFileDirectory();

ShellExecute( nppData._nppHandle, TEXT("open"), g_GitPrompt, NULL, pathName.c_str(), SW_SHOW );
}
Expand Down
2 changes: 1 addition & 1 deletion resource.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define VER_MAJOR 1
#define VER_MINOR 4
#define VER_RELEASE 4
#define VER_BUILD 2
#define VER_BUILD 3
#define VER_STRING STR(VER_MAJOR) "." STR(VER_MINOR) "." STR(VER_RELEASE) "." STR(VER_BUILD)

#define FILE_DESCRIPTION "Notepad++ Plugin for Git SCM."
Expand Down

0 comments on commit f9b4f26

Please sign in to comment.