Skip to content

Commit 808dfc7

Browse files
committed
[FIX] server: avoid directory duplication in custom entry point
1 parent 5d9f3b7 commit 808dfc7

File tree

1 file changed

+4
-14
lines changed

1 file changed

+4
-14
lines changed

server/src/core/entry_point.rs

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ impl EntryPointMgr {
129129
}
130130

131131
/* Create a new entry to public.
132-
return the disk_dir symbol of the last FOLDER of the path
132+
return the symbol at the end of the path
133133
*/
134134
pub fn add_entry_to_customs(session: &mut SessionInfo, path: String) -> Option<Rc<RefCell<Symbol>>> {
135135
info!("Adding new custom entry point: {}", path);
@@ -140,26 +140,16 @@ impl EntryPointMgr {
140140
None,
141141
None);
142142
session.sync_odoo.entry_point_mgr.borrow_mut().custom_entry_points.push(entry.clone());
143-
let sym = EntryPointMgr::_create_dir_symbols_for_new_entry(session, &path, entry);
144-
sym
143+
EntryPointMgr::_create_dir_symbols_for_new_entry(session, &path, entry)
145144
}
146145

147146
fn _create_dir_symbols_for_new_entry(session: &mut SessionInfo, path: &String, entry: Rc<RefCell<EntryPoint>>) -> Option<Rc<RefCell<Symbol>>> {
148-
let is_file = path.ends_with(".py") || path.ends_with(".pyi");
149-
match is_file {
150-
true => {
151-
EntryPointMgr::create_dir_symbols_from_path_to_entry(session, &PathBuf::from(path).parent().unwrap().to_path_buf(), entry)
152-
},
153-
false => {
154-
EntryPointMgr::create_dir_symbols_from_path_to_entry(session, &PathBuf::from(path), entry)
155-
}
156-
}
147+
EntryPointMgr::create_dir_symbols_from_path_to_entry(session, &PathBuf::from(path), entry)
157148
}
158149

159150
pub fn create_new_custom_entry_for_path(session: &mut SessionInfo, path: &String) -> bool {
160151
let path_sanitized = PathBuf::from(path).sanitize();
161-
let parent = EntryPointMgr::add_entry_to_customs(session, path_sanitized.clone());
162-
let new_sym = Symbol::create_from_path(session, &PathBuf::from(path), parent.unwrap().clone(), false);
152+
let new_sym = EntryPointMgr::add_entry_to_customs(session, path_sanitized.clone());
163153
if let Some(new_sym) = new_sym {
164154
new_sym.borrow_mut().set_is_external(false);
165155
let new_sym_typ = new_sym.borrow().typ();

0 commit comments

Comments
 (0)