{"record":{"id":"7f93f6b0339306b5","repo":"FyroxEngine/Fyrox","slug":"failed-to-copy-file-to-the-folder-reason","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/android.rs","lineNumber":87,"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(package_name: &str, destination_folder: &Path) {\n    if let Ok(adb) = utils::make_command(\"adb\")\n        .current_dir(destination_folder)\n        .arg(\"install\")\n        .arg(format!(\"{package_name}.apk\"))","sourceCodeStart":69,"sourceCodeEnd":105,"githubUrl":"https://github.com/FyroxEngine/Fyrox/blob/76c91aad8eca488ce527b1af707be8b3b24ad72d/fyrox-build-tools/src/export/android.rs#L69-L105","documentation":"Logged warning in fyrox-build-tools' Android export when std::fs::copy fails while copying a binary (e.g. the game executable or .so) into the Android export folder. The export continues but the built artifact will be incomplete. It is a non-fatal, logged warning rather than a panic.","triggerScenarios":"copy_binaries on fyrox-build-tools/src/export/android.rs iterates source files and calls fs::copy; the Err arm logs this message with the source path, destination folder, and the io::Error.","commonSituations":"Source binary missing or deleted after build, destination folder does not exist or lacks write permission, file locked by antivirus/another process, cross-device copy, disk full.","solutions":["Create the destination folder (fs::create_dir_all) before calling copy_binaries","Verify the source binary path exists after the cargo/gradle build completes","Check write permissions on the Android export data folder and free disk space","Rebuild the project so the source binary is regenerated, then re-run the export"],"exampleFix":"// before\nfs::copy(&path, &dst_path).unwrap();\n// after\nfs::create_dir_all(&destination_folder)?;\nmatch fs::copy(&path, &dst_path) {\n    Ok(_) => Log::info(format!(\"Copied {}\", path.display())),\n    Err(e) => Log::warn(format!(\"Copy failed: {e}\")),\n}","handlingStrategy":"fallback","validationCode":"if !path.exists() { eprintln!(\"skip missing {}\", path.display()); }\nif !destination_folder.exists() { fs::create_dir_all(&destination_folder)?; }","typeGuard":"fn copyable(src: &Path, dst: &Path) -> bool { src.is_file() && dst.is_dir() || fs::create_dir_all(dst).is_ok() }","tryCatchPattern":"match fs::copy(&path, &dst) {\n    Ok(_) => {},\n    Err(e) if e.kind() == ErrorKind::PermissionDenied => return Err(e.into()),\n    Err(e) => Log::warn(format!(\"copy failed: {e}\")),\n}","preventionTips":["Always create_dir_all the export destination before copying","Check the build output exists right after the build step","Exclude the export dir from antivirus scanning"],"tags":["android","export","file-copy","io"],"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"}