Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions Packages/OsaurusCore/AppDelegate.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ public final class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelega
// the specific crash class this prevents.
MLXErrorRecovery.installGlobalHandler()

// Register in-tree document format adapters before any file-ingress
// path can run. Idempotent; safe if a future migration moves this.
DocumentAdaptersBootstrap.registerBuiltIns()

// Detect repeated startup crashes and enter safe mode if needed
LaunchGuard.checkOnLaunch()

Expand Down Expand Up @@ -175,7 +179,7 @@ public final class AppDelegate: NSObject, NSApplicationDelegate, NSPopoverDelega
#endif

// Initialize directory access early so security-scoped bookmark is active
let _ = DirectoryPickerService.shared
_ = DirectoryPickerService.shared

if LaunchGuard.isSafeMode {
NotificationService.shared.postSafeModeActive()
Expand Down Expand Up @@ -876,7 +880,7 @@ extension AppDelegate {
}

@objc private func handleServeCommand(_ note: Notification) {
var desiredPort: Int? = nil
var desiredPort: Int?
var exposeFlag: Bool = false
if let ui = note.userInfo {
if let p = ui["port"] as? Int {
Expand Down
14 changes: 7 additions & 7 deletions Packages/OsaurusCore/Folder/FolderTools.swift
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,9 @@ enum FolderToolHelpers {
static func detectProjectType(_ url: URL) -> ProjectType {
let fm = FileManager.default
for projectType in ProjectType.allCases where projectType != .unknown {
for manifestFile in projectType.manifestFiles {
if fm.fileExists(atPath: url.appendingPathComponent(manifestFile).path) {
return projectType
}
for manifestFile in projectType.manifestFiles
where fm.fileExists(atPath: url.appendingPathComponent(manifestFile).path) {
return projectType
}
}
return .unknown
Expand Down Expand Up @@ -638,9 +637,7 @@ struct FileSearchTool: OsaurusTool {
if let pattern = filePattern {
let regex = pattern.replacingOccurrences(of: ".", with: "\\.")
.replacingOccurrences(of: "*", with: ".*")
if fileURL.lastPathComponent.range(of: "^\(regex)$", options: .regularExpression)
== nil
{
if fileURL.lastPathComponent.range(of: "^\(regex)$", options: .regularExpression) == nil {
continue
}
}
Expand Down Expand Up @@ -1016,6 +1013,9 @@ enum FolderToolFactory {
FileWriteTool(rootPath: rootPath),
FileEditTool(rootPath: rootPath),
FileSearchTool(rootPath: rootPath),
ReadWorkbookTool(rootPath: rootPath),
ReadWorkbookCellTool(rootPath: rootPath),
WriteWorkbookTool(rootPath: rootPath),
]
}

Expand Down
Loading
Loading