Skip to content

Commit eff3249

Browse files
committed
Fix: Add Darwin import and improve d_name access for POSIX API compatibility
1 parent b4e3ae3 commit eff3249

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

lara/views/FileManagerView.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77

88
import SwiftUI
99
import Foundation
10+
import Darwin
1011

1112
struct FileItem: Identifiable {
1213
let id: UUID
@@ -41,7 +42,8 @@ class FileListerPOSIX: NSObject {
4142
defer { closedir(dir) }
4243

4344
while let entry = readdir(dir) {
44-
let name = String(cString: entry.pointee.d_name)
45+
let nameBytes = entry.pointee.d_name
46+
let name = String(cString: nameBytes)
4547

4648
// Skip . and ..
4749
if name == "." || name == ".." {

0 commit comments

Comments
 (0)