mirror of
https://codeberg.org/PLG-Development/PLG-MuDiCS
synced 2026-07-05 16:37:09 +00:00
fix(control): fix create folder on main level path
This commit is contained in:
@@ -103,7 +103,7 @@ export async function create_folders(ip: string, path: string, folder_names: str
|
||||
let command = `cd ".${path}"`;
|
||||
|
||||
for (const part of folder_names) {
|
||||
command += `&& mkdir "${part}" && cd "${part}/"`;
|
||||
command += ` && mkdir "${part}" && cd "${part}/"`;
|
||||
}
|
||||
|
||||
const raw_response = await run_shell_command(ip, command);
|
||||
|
||||
@@ -298,9 +298,9 @@ export async function run_for_selected_files_on_selected_displays(action: (ip: s
|
||||
}
|
||||
|
||||
export function get_longest_existing_path_and_needed_parts(path: string, display_id: string, all_files: Record<string, Record<string, FolderElement[]>>): { existing: string; needed: string[] } {
|
||||
const path_parts = path.slice(0, path.length - 1).split('/');
|
||||
for (let i = path_parts.length; i > 1; i--) {
|
||||
const current_path = [...path_parts].splice(0, i).join('/') + '/';;
|
||||
const path_parts = path.slice(1, path.length - 1).split('/').filter(e => e.length !== 0); // remove front and back / and split after that, then remove empty strings
|
||||
for (let i = path_parts.length; i > 0; i--) {
|
||||
const current_path = '/' + [...path_parts].splice(0, i).join('/') + '/';;
|
||||
if (all_files.hasOwnProperty(current_path)) {
|
||||
if (all_files[current_path].hasOwnProperty(display_id)) {
|
||||
return { existing: current_path, needed: [...path_parts].splice(i) };
|
||||
|
||||
Reference in New Issue
Block a user