Skip to content

Commit

Permalink
Merge branch 'sotopia-aact-frontend' of https://github.com/sotopia-la…
Browse files Browse the repository at this point in the history
…b/sotopia into sotopia-aact-frontend
  • Loading branch information
akhatua2 committed Nov 23, 2024
2 parents 6f54198 + 50a88c1 commit 35e9294
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions examples/experimental/nodes/frontend/src/hooks/useFileSystems.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,11 +132,11 @@ export const useFileSystem = () => {

const updateFileSystemFromList = (fileList: string[]) => {
// Initialize root workspace folder
const newTree: FileNode[] = [{
name: 'workspace',
type: 'folder',
path: '/workspace',
children: []
const newTree: FileNode[] = [{
name: 'workspace',
type: 'folder',
path: '/workspace',
children: []
}];

// Create a set of existing file paths for quick lookup
Expand All @@ -147,7 +147,7 @@ export const useFileSystem = () => {
// Clean up the file path
const cleanedPath = filePath.replace(/^\/workspace\//, '').trim().replace(/\\r/g, ''); // Remove \r
const segments = cleanedPath.split('/').filter(Boolean);

if (segments.length === 0) return; // Skip if it's just the workspace folder

let currentLevel = newTree[0].children!;
Expand All @@ -156,7 +156,7 @@ export const useFileSystem = () => {
// Process each segment of the path
segments.forEach((segment, index) => {
currentPath += '/' + segment;

// If we're at the last segment, it's a file
if (index === segments.length - 1) {
// Check if the file already exists
Expand All @@ -166,7 +166,7 @@ export const useFileSystem = () => {
type: 'file',
path: currentPath
});
}
}
} else {
// It's a folder
let folder = currentLevel.find(
Expand Down

0 comments on commit 35e9294

Please sign in to comment.