{"record":{"id":"13ae6a23416c943f","repo":"FyroxEngine/Fyrox","slug":"failed-to-copy-file-to-the-folder-reason-13ae6a","errorCode":null,"errorMessage":"Failed to copy {} file to the {} folder. Reason: {:?}","messagePattern":"Failed to copy (.+?) file to the (.+?) folder\\. Reason: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"fyrox-build-tools/src/export/pc.rs","lineNumber":75,"sourceCode":"\n        if let Some(stem) = entry.path().file_stem() {\n            if stem == OsStr::new(package_name) {\n                binary_paths.push(entry.path());\n            }\n        }\n    }\n    for path in binary_paths {\n        if let Some(file_name) = path.file_name() {\n            match fs::copy(&path, destination_folder.join(file_name)) {\n                Ok(_) => {\n                    Log::info(format!(\n                        \"{} was successfully copied to the {} folder.\",\n                        path.display(),\n                        destination_folder.display()\n                    ));\n                }\n                Err(err) => {\n                    Log::warn(format!(\n                        \"Failed to copy {} file to the {} folder. Reason: {:?}\",\n                        path.display(),\n                        destination_folder.display(),\n                        err\n                    ));\n                }\n            }\n        }\n    }\n\n    Ok(())\n}\n\npub fn run_build(destination_folder: &Path, package_name: &str) {\n    #[allow(unused_mut)]\n    let mut path = destination_folder.join(package_name);\n    #[cfg(windows)]\n    {","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/FyroxEngine/Fyrox/blob/76c91aad8eca488ce527b1af707be8b3b24ad72d/fyrox-build-tools/src/export/pc.rs#L57-L93","documentation":"Logged warning in fyrox-build-tools' PC export when std::fs::copy fails while copying the game binary or its dependencies into the destination export folder. Like the Android variant, it is non-fatal but leaves the export incomplete. The io::Error is included in the message.","triggerScenarios":"copy_binaries in fyrox-build-tools/src/export/pc.rs calls fs::copy for each discovered binary; the Err arm logs this with path, destination folder, and error.","commonSituations":"Destination exe locked because the game is still running, destination folder missing, permission denied in Program Files-like locations, antivirus quarantining the freshly built exe.","solutions":["Close the running game instance that locks the destination binary","Create the destination folder with fs::create_dir_all before exporting","Run the export with write permission for the destination (avoid copying into protected system dirs)","Whitelist the build/export directory in antivirus software and retry"],"exampleFix":"// before\nLog::warn(format!(\"Failed to copy {} ...\", path.display()));\n// after\nfs::create_dir_all(&destination_folder)?;\nfs::copy(&path, &dst).map_err(|e| anyhow!(\"copy {} -> {}: {e}\", path.display(), dst.display()))?;","handlingStrategy":"fallback","validationCode":"assert!(path.is_file(), \"source binary missing: {}\", path.display());\nfs::create_dir_all(&destination_folder)?;","typeGuard":null,"tryCatchPattern":"fs::copy(&path, &dst).or_else(|e| {\n    Log::warn(format!(\"copy {} failed: {e}\", path.display()));\n    Err(e)\n})?;","preventionTips":["Stop the game process before overwriting its exe","Create destination directories up front","Retry copy once on transient locks (antivirus)"],"tags":["export","file-copy","io","pc"],"backgroundTag":"file-write-failed","analyzedSha":"76c91aad8eca488ce527b1af707be8b3b24ad72d","analyzedAt":"2026-09-10T16:04:01.633Z","contentChangedAt":"2026-09-10T16:04:01.633Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}