[Windows] Replace symlink by .bat
Windows can't run executable file from symlink so it's necessary to create .bat to run in folder
This commit is contained in:
parent
ec5d28731c
commit
824fccecd3
1 changed files with 7 additions and 4 deletions
|
@ -2,9 +2,6 @@ use std::env::consts;
|
|||
use std::path::PathBuf;
|
||||
use std::fs;
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
use std::os::windows::fs::symlink_file;
|
||||
|
||||
fn file_is_executable(path: &PathBuf) -> bool {
|
||||
if consts::FAMILY == "windows" {
|
||||
match path.extension() {
|
||||
|
@ -49,7 +46,13 @@ pub fn create_symlink_of_binary_files(install_package_folder: &PathBuf, binary_p
|
|||
let output_path = binary_package_folder.join(file.file_name().ok_or(format!("Failed to get filename"))?);
|
||||
|
||||
#[cfg(target_os = "windows")]
|
||||
symlink_file(file.as_os_str(), output_path.as_os_str()).map_err(|_| format!("Failed to create symlink"))?;
|
||||
{
|
||||
let file_path = file.as_os_str().to_str().ok_or(format!("Failed to get filename str"))?;
|
||||
fs::write(output_path, format!("
|
||||
@echo off
|
||||
{} %*
|
||||
", file_path)).map_err(|_| format!("Failed to create symlink"))?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
|
|
Reference in a new issue