Skip to content

Commit 7b60ed9

Browse files
- Added distinction between files and folders
1 parent 11015cc commit 7b60ed9

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

Sources/WelcomeWindow/Model/RecentsStore.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,17 @@ public enum RecentsStore {
5757
}
5858
}
5959

60+
// MARK: - Folder / file specific access
61+
/// Recent entries that are directories (projects that live in folders, asset catalogs, …)
62+
public static func recentDirectoryURLs() -> [URL] {
63+
filterURLs { $0.isDirectory }
64+
}
65+
66+
/// Recent entries that are regular files (App documents, text files, …)
67+
public static func recentFileURLs() -> [URL] {
68+
filterURLs { !$0.isDirectory }
69+
}
70+
6071
/// Notifies the store that a project was opened.
6172
///
6273
/// This saves a security-scoped bookmark for the URL and moves it to the top of the recent list.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
//
2+
// URL+isDirectory.swift
3+
// WelcomeWindow
4+
//
5+
// Created by Giorgi Tchelidze on 08.06.25.
6+
//
7+
8+
import SwiftUI
9+
10+
extension URL {
11+
/// True when the URL represents a directory (folders and file‐packages).
12+
var isDirectory: Bool {
13+
(try? resourceValues(forKeys: [.isDirectoryKey]).isDirectory) == true
14+
}
15+
}

0 commit comments

Comments
 (0)