Browse Source

解决错误的对dragonos内的路径进行正则化的问题 (#7)

* 解决错误的对dragonos内的路径进行正则化的问题

* 添加版本号
login 1 year ago
parent
commit
91d0a6c0ff
4 changed files with 14 additions and 9 deletions
  1. 6 1
      Cargo.toml
  2. 3 2
      src/executor/mod.rs
  3. 4 1
      src/parser/mod.rs
  4. 1 5
      src/parser/task.rs

+ 6 - 1
Cargo.toml

@@ -1,13 +1,18 @@
 [package]
 name = "dadk"
 authors = ["longjin <longjin@DragonOS.org>"]
-version = "0.1.0"
+version = "0.1.0-20230511"
 edition = "2021"
 description = "DragonOS Application Development Kit\nDragonOS应用开发工具"
 license = "GPL-2.0-only"
 repository = "https://github.com/DragonOS-Community/DADK.git"
 readme = "README.md"
 
+[[bin]]
+name = "dadk"
+path = "src/main.rs"
+doc = true
+
 # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 
 [dependencies]

+ 3 - 2
src/executor/mod.rs

@@ -7,7 +7,7 @@ use std::{
     sync::RwLock,
 };
 
-use log::{error, info, warn};
+use log::{error, info, warn, debug};
 
 use crate::{
     console::{clean::CleanLevel, Action},
@@ -149,6 +149,7 @@ impl Executor {
         info!("Installing task: {}", self.entity.task().name_version());
         let mut in_dragonos_path = in_dragonos_path.unwrap().to_string_lossy().to_string();
 
+        debug!("in_dragonos_path: {}", in_dragonos_path);
         // 去除开头的斜杠
         {
             let count_leading_slashes = in_dragonos_path.chars().take_while(|c| *c == '/').count();
@@ -156,7 +157,7 @@ impl Executor {
         }
         // 拼接最终的安装路径
         let install_path = self.dragonos_sysroot.join(in_dragonos_path);
-        // debug!("install_path: {:?}", install_path);
+        debug!("install_path: {:?}", install_path);
         // 创建安装路径
         std::fs::create_dir_all(&install_path).map_err(|e| {
             ExecutorError::InstallError(format!("Failed to create install path: {}", e.to_string()))

+ 4 - 1
src/parser/mod.rs

@@ -28,7 +28,7 @@ use std::{
     path::PathBuf,
 };
 
-use log::{error, info};
+use log::{error, info, debug};
 
 use self::task::DADKTask;
 pub mod task;
@@ -181,6 +181,7 @@ impl Parser {
         let mut result_vec = Vec::new();
         for config_file in &self.config_files {
             let task: DADKTask = self.parse_config_file(config_file)?;
+            debug!("Parsed config file {}: {:?}", config_file.display(), task);
             result_vec.push((config_file.clone(), task));
         }
 
@@ -209,6 +210,8 @@ impl Parser {
             error: InnerParserError::JsonError(e),
         })?;
 
+        debug!("Parsed config file {}: {:?}", config_file.display(), task);
+
         // 去除字符串中的空白字符
         task.trim();
 

+ 1 - 5
src/parser/task.rs

@@ -228,11 +228,7 @@ impl InstallConfig {
         return Ok(());
     }
 
-    pub fn trim(&mut self) {
-        if let Some(in_dragonos_path) = &mut self.in_dragonos_path {
-            *in_dragonos_path = in_dragonos_path.canonicalize().unwrap();
-        }
-    }
+    pub fn trim(&mut self) {}
 }
 
 /// # 清理配置