Skip to content

Commit

Permalink
fix(installer): fail uploading on Linux (#76)
Browse files Browse the repository at this point in the history
Fixed cache directory creation
  • Loading branch information
csarnataro committed Jun 3, 2024
1 parent d94252b commit 8f29fe6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions installer/src-tauri/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]

use std::fmt::Debug;
use std::fs::{File, OpenOptions};
use std::fs::{self, File, OpenOptions};
use std::io;
use std::io::Write;
use std::path::Path;
Expand Down Expand Up @@ -62,10 +62,13 @@ fn append_config(
.resolve_resource(bin_path)
.ok_or(CmdError::Resolve("source path"))?;

let dst_path = path
let cache_dir = path
.app_cache_dir()
.ok_or(CmdError::Resolve("cache dir path"))?
.join("sketch.cfg.bin");
.ok_or(CmdError::Resolve("cache dir path"))?;

fs::create_dir_all(&cache_dir)?;

let dst_path = cache_dir.join("sketch.cfg.bin");

let mut src = File::open(src_path)?;
let mut dst = OpenOptions::new()
Expand Down
1 change: 1 addition & 0 deletions installer/src/services/arduino-cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const upload = ({ dstPath, fqbn, port, onData, onClose, onError }) => {

try {
command.stdout.on('data', onData);
command.stderr.on('data', onData);
command.on('close', onClose);
command.spawn().then((child) => {
console.log('pid:', child.pid);
Expand Down

0 comments on commit 8f29fe6

Please sign in to comment.