Commit 7119821e13
Copy SHA
7119821e1398fbe6bc6b8362f2b2f6df5d8001ab
parent: 3bbfa4afd1
Verified · cmc
cmc <hello@cleberg.net> · 2026-11-25 23:58 UTC
iOS Folders: errors say what failed
Adding, creating and deleting files and folders set an error title
(Couldn't Add Folder, Couldn't Create File, Couldn't Delete Folder and the
like), which the folder list shows as the error's first line.
Ref #222
Changed files (2)
Sources/OrgstarMobile/FoldersScreen.swift
+10 −5 · view
@@ -43,7 +43,8 @@ struct FoldersScreen: View {
43 43 }
44 44 }
45 45 if let error = workspace . lastError {
46 Text ( error ) . foregroundStyle ( . red )
46 // T h e t i t l e s a y s w h a t f a i l e d .
47 Text ( workspace . lastErrorTitle . map { " \( $0 ) \n \( error ) " } ? ? error ) . foregroundStyle ( . red )
47 48 }
48 49 }
49 50 . navigationTitle ( " Folders " )
@@ -57,7 +58,7 @@ struct FoldersScreen: View {
57 58 try await workspace . trash ( root )
58 59 try workspace . removeRoot ( path : root )
59 60 } catch {
60 workspace . lastError = " Can't delete \( ( root as NSString ) . lastPathComponent ) : \( error . localizedDescription ) "
61 workspace . showError ( String ( localized : " Couldn't Delete Folder " , comment : " Error alert title " ) , error . localizedDescription )
61 62 }
62 63 }
63 64 }
@@ -124,7 +125,7 @@ struct FoldersScreen: View {
124 125 do {
125 126 try await workspace . addRoot ( url )
126 127 } catch {
127 workspace . lastError = " Can't add \( url . lastPathComponent ) : \( error . localizedDescription ) "
128 workspace . showError ( String ( localized : " Couldn't Add Folder " , comment : " Error alert title " ) , error . localizedDescription )
128 129 }
129 130 }
130 131 }
@@ -198,7 +199,8 @@ private struct NewItemAlert: ViewModifier {
198 199 if item . isFolder { try Self . makeFolder ( typed , in : item . folder ) } else { _ = try await workspace . createFile ( named : typed , in : item . folder ) }
199 200 created ( )
200 201 } catch {
201 workspace . lastError = error . localizedDescription
202 workspace . showError ( item . isFolder ? String ( localized : " Couldn't Create Folder " , comment : " Error alert title " )
203 : String ( localized : " Couldn't Create File " , comment : " Error alert title " ) , error . localizedDescription )
202 204 }
203 205 }
204 206 }
@@ -236,7 +238,10 @@ private extension View {
236 238 deleting . wrappedValue = nil
237 239 session . kill ( path )
238 240 Task {
239 do { try await workspace . trash ( path ) } catch { workspace . lastError = " Can't delete \( name ) : \( error . localizedDescription ) " }
241 do { try await workspace . trash ( path ) } catch {
242 workspace . showError ( folder ? String ( localized : " Couldn't Delete Folder " , comment : " Error alert title " )
243 : String ( localized : " Couldn't Delete File " , comment : " Error alert title " ) , error . localizedDescription )
244 }
240 245 deleted ( )
241 246 }
242 247 }
l10n/Localizable.xcstrings
+140 · view
@@ -9792,6 +9792,146 @@
9792 9792 }
9793 9793 }
9794 9794 },
9795 "Couldn't Create File": {
9796 "comment": "Error alert title",
9797 "localizations": {
9798 "de": {
9799 "stringUnit": {
9800 "state": "translated",
9801 "value": "Datei konnte nicht erstellt werden"
9802 }
9803 },
9804 "es": {
9805 "stringUnit": {
9806 "state": "translated",
9807 "value": "No se ha podido crear el archivo"
9808 }
9809 },
9810 "fr": {
9811 "stringUnit": {
9812 "state": "translated",
9813 "value": "Impossible de créer le fichier"
9814 }
9815 },
9816 "ja": {
9817 "stringUnit": {
9818 "state": "translated",
9819 "value": "ファイルを作成できませんでした"
9820 }
9821 },
9822 "pt-BR": {
9823 "stringUnit": {
9824 "state": "translated",
9825 "value": "Não Foi Possível Criar o Arquivo"
9826 }
9827 }
9828 }
9829 },
9830 "Couldn't Create Folder": {
9831 "comment": "Error alert title",
9832 "localizations": {
9833 "de": {
9834 "stringUnit": {
9835 "state": "translated",
9836 "value": "Ordner konnte nicht erstellt werden"
9837 }
9838 },
9839 "es": {
9840 "stringUnit": {
9841 "state": "translated",
9842 "value": "No se ha podido crear la carpeta"
9843 }
9844 },
9845 "fr": {
9846 "stringUnit": {
9847 "state": "translated",
9848 "value": "Impossible de créer le dossier"
9849 }
9850 },
9851 "ja": {
9852 "stringUnit": {
9853 "state": "translated",
9854 "value": "フォルダを作成できませんでした"
9855 }
9856 },
9857 "pt-BR": {
9858 "stringUnit": {
9859 "state": "translated",
9860 "value": "Não Foi Possível Criar a Pasta"
9861 }
9862 }
9863 }
9864 },
9865 "Couldn't Delete File": {
9866 "comment": "Error alert title",
9867 "localizations": {
9868 "de": {
9869 "stringUnit": {
9870 "state": "translated",
9871 "value": "Datei konnte nicht gelöscht werden"
9872 }
9873 },
9874 "es": {
9875 "stringUnit": {
9876 "state": "translated",
9877 "value": "No se ha podido eliminar el archivo"
9878 }
9879 },
9880 "fr": {
9881 "stringUnit": {
9882 "state": "translated",
9883 "value": "Impossible de supprimer le fichier"
9884 }
9885 },
9886 "ja": {
9887 "stringUnit": {
9888 "state": "translated",
9889 "value": "ファイルを削除できませんでした"
9890 }
9891 },
9892 "pt-BR": {
9893 "stringUnit": {
9894 "state": "translated",
9895 "value": "Não Foi Possível Apagar o Arquivo"
9896 }
9897 }
9898 }
9899 },
9900 "Couldn't Delete Folder": {
9901 "comment": "Error alert title",
9902 "localizations": {
9903 "de": {
9904 "stringUnit": {
9905 "state": "translated",
9906 "value": "Ordner konnte nicht gelöscht werden"
9907 }
9908 },
9909 "es": {
9910 "stringUnit": {
9911 "state": "translated",
9912 "value": "No se ha podido eliminar la carpeta"
9913 }
9914 },
9915 "fr": {
9916 "stringUnit": {
9917 "state": "translated",
9918 "value": "Impossible de supprimer le dossier"
9919 }
9920 },
9921 "ja": {
9922 "stringUnit": {
9923 "state": "translated",
9924 "value": "フォルダを削除できませんでした"
9925 }
9926 },
9927 "pt-BR": {
9928 "stringUnit": {
9929 "state": "translated",
9930 "value": "Não Foi Possível Apagar a Pasta"
9931 }
9932 }
9933 }
9934 },
9795 9935 "Couldn't Find Folder": {
9796 9936 "comment": "Error alert title",
9797 9937 "localizations": {