Skip to content

Commit

Permalink
Removing directory field from Project
Browse files Browse the repository at this point in the history
  • Loading branch information
notdanilo committed Oct 25, 2023
1 parent afdec89 commit 498d264
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 14 deletions.
3 changes: 2 additions & 1 deletion ecosystem/rust/cargo/src/exporter/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ impl FileGenerator for CargoGenerator {
let file = file_set.entry(&PathBuf::from_str("Cargo.toml").unwrap());
let version = "0.1.0";
let name = &project.name;
let path = &project.directory;
// FIXME: This is a placeholder and it will fail.
let path = PathBuf::default();
let path = path.display().to_string().replace('\\', "/");
let content = format!(include_str!("Cargo.template.toml"), name = name, version = version, path = path);
file.writeln(content);
Expand Down
2 changes: 1 addition & 1 deletion ecosystem/rust/cargo/src/parser/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ impl Parser<&std::path::Path> for ProjectParser {
let name = NamingConvention::try_from(package.name.as_str())?;
let mut root_module = ModuleParser.parse(library_path.as_path())?;
root_module.identifier = SnakeCase::try_from(name.clone())?.to_string().into();
Ok(Self::Output { directory, name, root_module })
Ok(Self::Output { name, root_module })
}
}
5 changes: 0 additions & 5 deletions ligen/ir/src/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,11 @@ use crate::conventions::naming::NamingConvention;
#[allow(missing_docs)]
#[derive(Debug, Default, Clone, Serialize, Deserialize, PartialEq)]
pub struct Project {
pub directory: std::path::PathBuf,
pub name: NamingConvention,
pub root_module: Module,
}

impl Project {
/// Project directory path.
pub fn directory(&self) -> &std::path::Path {
self.directory.as_path()
}
/// Get the project name.
pub fn name(&self) -> &NamingConvention {
&self.name
Expand Down
6 changes: 0 additions & 6 deletions tools/editor/src/gui/ui/layout/editor/ir/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,8 @@ impl Pane for Editor {
egui::menu::bar(ui, |ui| {
ui.menu_button("File", |ui| {
if ui.button("Save").clicked() {
let directory = self
.project
.directory
.display()
.to_string();
let file = rfd::FileDialog::new()
.add_filter("ligen-ir", &["lir"])
.set_directory(directory)
.save_file();
if let Some(file) = file {
self
Expand Down
1 change: 0 additions & 1 deletion tools/editor/src/gui/ui/layout/editor/ir/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ impl Project {
.id_source("project")
.show(ui, |ui| {
StringEditableField::new().show(ui, &mut project.name);
Directory::new().show(ui, &mut project.directory);
Module::new().show(ui, &mut project.root_module);
});
});
Expand Down

0 comments on commit 498d264

Please sign in to comment.