mirror of
https://github.com/HeyPuter/puter.git
synced 2026-08-25 15:37:12 +00:00
feat: allow launchApp to open explorer at a specific path
This commit is contained in:
@@ -2879,6 +2879,10 @@ window.navbar_path_droppable = (el_window)=>{
|
||||
*
|
||||
*/
|
||||
window.navbar_path = (abs_path)=>{
|
||||
// remove trailing slash
|
||||
if(abs_path.endsWith('/') && abs_path !== '/')
|
||||
abs_path = abs_path.slice(0, -1);
|
||||
|
||||
const dirs = (abs_path === '/' ? [''] : abs_path.split('/'));
|
||||
const dirpaths = (abs_path === '/' ? ['/'] : [])
|
||||
const path_seperator_html = `<img class="path-seperator" draggable="false" src="${html_encode(window.icons['triangle-right.svg'])}">`;
|
||||
|
||||
@@ -129,6 +129,20 @@ const launch_app = async (options)=>{
|
||||
else
|
||||
title = path.dirname(options.path);
|
||||
|
||||
// if options.args.path is provided, use it as the path
|
||||
if(options.args?.path){
|
||||
// if args.path is provided, enforce the directory
|
||||
let fsentry = await puter.fs.stat(options.args.path);
|
||||
if(!fsentry.is_dir){
|
||||
let parent = path.dirname(options.args.path);
|
||||
if(parent === options.args.path)
|
||||
parent = window.home_path;
|
||||
options.path = parent;
|
||||
}else{
|
||||
options.path = options.args.path;
|
||||
}
|
||||
}
|
||||
|
||||
// open window
|
||||
el_win = UIWindow({
|
||||
element_uuid: uuid,
|
||||
|
||||
Reference in New Issue
Block a user