Fix directory navigation and path initialization
- Initialize browser path to the actual startup directory instead of '/' - Improve '..' navigation to be relative to the filesystem root - Fix path duplication issues by avoiding redundant absolute path joining
This commit is contained in:
@@ -66,7 +66,7 @@ type Logic struct {
|
||||
}
|
||||
|
||||
// NewLogic creates a new Logic instance, accepting an optional mockFS.
|
||||
func NewLogic(mfs pool.FileSystem) *Logic {
|
||||
func NewLogic(mfs pool.FileSystem, startPath ...string) *Logic {
|
||||
state := NewState()
|
||||
TheState = state
|
||||
|
||||
@@ -81,8 +81,12 @@ func NewLogic(mfs pool.FileSystem) *Logic {
|
||||
wp := pool.NewWorkerPool(4)
|
||||
wp.Start()
|
||||
|
||||
// Set browser initial path to mock root
|
||||
state.Browser.CurrentPath = "/"
|
||||
// Set browser initial path
|
||||
path := "/"
|
||||
if len(startPath) > 0 {
|
||||
path = startPath[0]
|
||||
}
|
||||
state.Browser.CurrentPath = path
|
||||
bm, _ := browser.NewBrowserManager(&state.Browser, wp, mockFS)
|
||||
|
||||
TheLogic = &Logic{
|
||||
|
||||
Reference in New Issue
Block a user