MCPcopy Create free account
hub / github.com/AutoHotkey/AutoHotkey / FileRecycle

Method FileRecycle

source/script_autoit.cpp:1306–1333  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1304
1305
1306ResultType Line::FileRecycle(LPTSTR aFilePattern)
1307{
1308 if (!aFilePattern || !*aFilePattern)
1309 return LineError(ERR_PARAM1_MUST_NOT_BE_BLANK, FAIL_OR_OK); // Since this is probably not what the user intended.
1310
1311 SHFILEOPSTRUCT FileOp;
1312 TCHAR szFileTemp[_MAX_PATH+2];
1313
1314 // au3: Get the fullpathname - required for UNDO to work
1315 Util_GetFullPathName(aFilePattern, szFileTemp);
1316
1317 // au3: We must also make it a double nulled string *sigh*
1318 szFileTemp[_tcslen(szFileTemp)+1] = '\0';
1319
1320 // au3: set to known values - Corrects crash
1321 FileOp.hNameMappings = NULL;
1322 FileOp.lpszProgressTitle = NULL;
1323 FileOp.fAnyOperationsAborted = FALSE;
1324 FileOp.hwnd = NULL;
1325 FileOp.pTo = NULL;
1326
1327 FileOp.pFrom = szFileTemp;
1328 FileOp.wFunc = FO_DELETE;
1329 FileOp.fFlags = FOF_SILENT | FOF_ALLOWUNDO | FOF_NOCONFIRMATION | FOF_WANTNUKEWARNING;
1330
1331 // SHFileOperation() returns 0 on success:
1332 return ThrowIfTrue(SHFileOperation(&FileOp));
1333}
1334
1335
1336

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected