@@ -1685,21 +1685,25 @@ int CCmdLineContextMenu::EmptyFiles()
16851685int CCmdLineContextMenu::StartCopyFilesHere ()
16861686{
16871687 std::packaged_task<int ()> task ([&]() {
1688- return CopyFilesHere ();
1688+ string szFolderDroppedIn = string (m_szFolderDroppedIn);
1689+ return CopyFilesHere (m_strFilenames, szFolderDroppedIn);
16891690 });
16901691 std::future<int > res = task.get_future ();
16911692 std::thread (std::move (task)).detach ();
16921693 res.wait_for (1s);
1694+ return 1 ;
16931695}
16941696
16951697int CCmdLineContextMenu::StartMoveFilesHere ()
16961698{
16971699 std::packaged_task<int ()> task ([&]() {
1698- return MoveFilesHere ();
1700+ string szFolderDroppedIn = string (m_szFolderDroppedIn);
1701+ return MoveFilesHere (m_strFilenames, szFolderDroppedIn);
16991702 });
17001703 std::future<int > res = task.get_future ();
17011704 std::thread (std::move (task)).detach ();
17021705 res.wait_for (1s);
1706+ return 1 ;
17031707}
17041708
17051709void DoWork ()
@@ -1711,10 +1715,10 @@ void DoWork()
17111715 }
17121716}
17131717
1714- int CCmdLineContextMenu::CopyFilesHere ()
1718+ int CCmdLineContextMenu::CopyFilesHere (StringArray strFilenames, string szFolderDroppedIn )
17151719{
17161720 size_t lTotalItems, lFiles;
1717- lTotalItems = lFiles = m_strFilenames .size ();
1721+ lTotalItems = lFiles = strFilenames .size ();
17181722 size_t lDoneItems = 0 ;
17191723
17201724 IProgressDialog* pProgressDlg;
@@ -1734,7 +1738,7 @@ int CCmdLineContextMenu::CopyFilesHere()
17341738 TCHAR sDir [MAX_PATH_EX];
17351739 TCHAR sName [_MAX_FNAME];
17361740 TCHAR sExt [_MAX_EXT];
1737- _tsplitpath (m_strFilenames [i].data (), sDrive , sDir , sName , sExt );
1741+ _tsplitpath (strFilenames [i].data (), sDrive , sDir , sName , sExt );
17381742
17391743 if (pProgressDlg != NULL ) {
17401744 if (pProgressDlg->HasUserCancelled ())
@@ -1748,15 +1752,15 @@ int CCmdLineContextMenu::CopyFilesHere()
17481752 }
17491753
17501754 string sNewFilename = _T (" " );
1751- sNewFilename .append (m_szFolderDroppedIn ).append (_T (" \\ " )).append (sName ).append (sExt );
1755+ sNewFilename .append (szFolderDroppedIn ).append (_T (" \\ " )).append (sName ).append (sExt );
17521756 if (sNewFilename .rfind (_T (" \\\\ ?\\ " ), 0 ) != 0 )
17531757 sNewFilename = _T (" \\\\ ?\\ " ) + sNewFilename ;
17541758
1755- if (PathIsDirectory (m_strFilenames [i].data ())) {
1756- CopyDirectory (m_strFilenames [i].data (), sNewFilename , pProgressDlg, &lDoneItems, &lTotalItems);
1759+ if (PathIsDirectory (strFilenames [i].data ())) {
1760+ CopyDirectory (strFilenames [i].data (), sNewFilename , pProgressDlg, &lDoneItems, &lTotalItems);
17571761
17581762 } else {
1759- bool ret = CopyFile (m_strFilenames [i].data (), sNewFilename .c_str (), true );
1763+ bool ret = CopyFile (strFilenames [i].data (), sNewFilename .c_str (), true );
17601764 }
17611765 }
17621766
@@ -1849,10 +1853,10 @@ int CCmdLineContextMenu::CopyDirectory(string sourceDir, string destDir, IProgre
18491853 return 0 ;
18501854}
18511855
1852- int CCmdLineContextMenu::MoveFilesHere ()
1856+ int CCmdLineContextMenu::MoveFilesHere (StringArray strFilenames, string szFolderDroppedIn )
18531857{
18541858 size_t lFiles;
1855- lFiles = m_strFilenames .size ();
1859+ lFiles = strFilenames .size ();
18561860
18571861 IProgressDialog* pProgressDlg;
18581862 HRESULT hr = CoCreateInstance (CLSID_ProgressDialog, NULL , CLSCTX_INPROC_SERVER, IID_PPV_ARGS (&pProgressDlg));
@@ -1871,7 +1875,7 @@ int CCmdLineContextMenu::MoveFilesHere()
18711875 TCHAR sDir [MAX_PATH_EX];
18721876 TCHAR sName [_MAX_FNAME];
18731877 TCHAR sExt [_MAX_EXT];
1874- _tsplitpath (m_strFilenames [i].data (), sDrive , sDir , sName , sExt );
1878+ _tsplitpath (strFilenames [i].data (), sDrive , sDir , sName , sExt );
18751879
18761880 if (pProgressDlg != NULL ) {
18771881 if (pProgressDlg->HasUserCancelled ())
@@ -1884,7 +1888,7 @@ int CCmdLineContextMenu::MoveFilesHere()
18841888 }
18851889
18861890 string sNewFilename = _T (" " );
1887- sNewFilename .append (m_szFolderDroppedIn ).append (_T (" \\ " )).append (sName ).append (sExt );
1891+ sNewFilename .append (szFolderDroppedIn ).append (_T (" \\ " )).append (sName ).append (sExt );
18881892 if (sNewFilename .rfind (_T (" \\\\ ?\\ " ), 0 ) != 0 )
18891893 sNewFilename = _T (" \\\\ ?\\ " ) + sNewFilename ;
18901894
0 commit comments