[v2.beta.9] DirMove(Source, Dest, "R") failed Topic is solved

Report problems with documented functionality
User avatar
aseiot
Posts: 79
Joined: 05 Mar 2017, 04:25

[v2.beta.9] DirMove(Source, Dest, "R") failed

Post by aseiot » 16 Sep 2022, 08:33

Throw error if the 3rd parameter is "R".
Seems, should return OK after this: https://github.com/Lexikos/AutoHotkey_L/blob/cb82b941fd099de48c7837689261ac7a4775aa9b/source/lib/file.cpp#L1066

Code: Select all

bif_impl FResult DirMove(LPCTSTR aSource, LPCTSTR aDest, LPCTSTR aFlag)
{
	if (aFlag && ctoupper(*aFlag) == 'R')
	{
		// Perform a simple rename instead, which prevents the operation from being only partially
		// complete if the source directory is in use (due to being a working dir for a currently
		// running process, or containing a file that is being written to).  In other words,
		// the operation will be "all or none":
		if (!MoveFile(aSource, aDest))
			return FR_E_WIN32;
		return OK;					// <------------------ Return OK if success.
	}
	if (aFlag && !IsNumeric(aFlag))
		return FR_E_ARG(2);
	if (!*aSource) return FR_E_ARG(0);
	if (!*aDest) return FR_E_ARG(1);
	if (!Line::Util_CopyDir(aSource, aDest, aFlag ? ATOI(aFlag) : 0, true))
		return FR_E_FAILED;
	return OK;
}

lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: [v2.beta.9] DirMove(Source, Dest, "R") failed  Topic is solved

Post by lexikos » 02 Oct 2022, 02:35

Fixed by v2.0-beta.10.

Post Reply

Return to “Bug Reports”