@@ -156,14 +156,14 @@ public static boolean isPathInDirPath(String path, String dirPath, boolean ensur
156156 * failed, otherwise {@code null}.
157157 */
158158 public static String validateRegularFileExistenceAndPermissions (final Context context , final String path , final String parentDirPath , String permissionsToCheck , final boolean setMissingPermissions , final boolean ignoreErrorsIfPathIsUnderParentDirPath ) {
159- if (path == null || path .isEmpty ()) return context .getString (R .string .null_or_empty_file );
159+ if (path == null || path .isEmpty ()) return context .getString (R .string .error_null_or_empty_file );
160160
161161 try {
162162 File file = new File (path );
163163
164164 // If file exits but not a regular file
165165 if (file .exists () && !file .isFile ()) {
166- return context .getString (R .string .non_regular_file_found );
166+ return context .getString (R .string .error_non_regular_file_found );
167167 }
168168
169169 boolean isPathUnderParentDirPath = false ;
@@ -183,7 +183,7 @@ public static String validateRegularFileExistenceAndPermissions(final Context co
183183 // If path is not a regular file
184184 // Regular files cannot be automatically created so we do not ignore if missing
185185 if (!file .isFile ()) {
186- return context .getString (R .string .no_regular_file_found );
186+ return context .getString (R .string .error_no_regular_file_found );
187187 }
188188
189189 // If there is not parentDirPath restriction or path is not under parentDirPath or
@@ -197,7 +197,7 @@ public static String validateRegularFileExistenceAndPermissions(final Context co
197197 }
198198 // Some function calls may throw SecurityException, etc
199199 catch (Exception e ) {
200- return context .getString (R .string .validate_file_existence_and_permissions_failed_with_exception , path , e .getMessage ());
200+ return context .getString (R .string .error_validate_file_existence_and_permissions_failed_with_exception , path , e .getMessage ());
201201 }
202202
203203 return null ;
@@ -230,14 +230,14 @@ public static String validateRegularFileExistenceAndPermissions(final Context co
230230 * failed, otherwise {@code null}.
231231 */
232232 public static String validateDirectoryExistenceAndPermissions (final Context context , final String path , final String parentDirPath , String permissionsToCheck , final boolean createDirectoryIfMissing , final boolean setMissingPermissions , final boolean ignoreErrorsIfPathIsInParentDirPath , final boolean ignoreIfNotExecutable ) {
233- if (path == null || path .isEmpty ()) return context .getString (R .string .null_or_empty_directory );
233+ if (path == null || path .isEmpty ()) return context .getString (R .string .error_null_or_empty_directory );
234234
235235 try {
236236 File file = new File (path );
237237
238238 // If file exits but not a directory file
239239 if (file .exists () && !file .isDirectory ()) {
240- return context .getString (R .string .non_directory_file_found );
240+ return context .getString (R .string .error_non_directory_file_found );
241241 }
242242
243243 boolean isPathInParentDirPath = false ;
@@ -254,7 +254,7 @@ public static String validateDirectoryExistenceAndPermissions(final Context cont
254254 Logger .logVerbose (LOG_TAG , "Creating missing directory at path: \" " + path + "\" " );
255255 // If failed to create directory
256256 if (!file .mkdirs ()) {
257- return context .getString (R .string .creating_missing_directory_failed , path );
257+ return context .getString (R .string .error_creating_missing_directory_failed , path );
258258 }
259259 }
260260
@@ -271,7 +271,7 @@ public static String validateDirectoryExistenceAndPermissions(final Context cont
271271 // If path is not a directory
272272 // Directories can be automatically created so we can ignore if missing with above check
273273 if (!file .isDirectory ()) {
274- return context .getString (R .string .no_directory_found );
274+ return context .getString (R .string .error_no_directory_found );
275275 }
276276
277277 if (permissionsToCheck != null ) {
@@ -282,7 +282,7 @@ public static String validateDirectoryExistenceAndPermissions(final Context cont
282282 }
283283 // Some function calls may throw SecurityException, etc
284284 catch (Exception e ) {
285- return context .getString (R .string .validate_directory_existence_and_permissions_failed_with_exception , path , e .getMessage ());
285+ return context .getString (R .string .error_validate_directory_existence_and_permissions_failed_with_exception , path , e .getMessage ());
286286 }
287287
288288 return null ;
@@ -332,11 +332,11 @@ public static void setMissingFilePermissions(String path, String permissionsToSe
332332 * @return Returns the {@code errmsg} if validating permissions failed, otherwise {@code null}.
333333 */
334334 public static String checkMissingFilePermissions (Context context , String path , String permissionsToCheck , String fileType , boolean ignoreIfNotExecutable ) {
335- if (path == null || path .isEmpty ()) return context .getString (R .string .null_or_empty_path );
335+ if (path == null || path .isEmpty ()) return context .getString (R .string .error_null_or_empty_path );
336336
337337 if (!isValidPermissingString (permissionsToCheck )) {
338338 Logger .logError (LOG_TAG , "Invalid permissionsToCheck passed to checkMissingFilePermissions: \" " + permissionsToCheck + "\" " );
339- return context .getString (R .string .invalid_file_permissions_string_to_check );
339+ return context .getString (R .string .error_invalid_file_permissions_string_to_check );
340340 }
341341
342342 if (fileType == null || fileType .isEmpty ()) fileType = "File" ;
@@ -345,17 +345,17 @@ public static String checkMissingFilePermissions(Context context, String path, S
345345
346346 // If file is not readable
347347 if (permissionsToCheck .contains ("r" ) && !file .canRead ()) {
348- return context .getString (R .string .file_not_readable , fileType );
348+ return context .getString (R .string .error_file_not_readable , fileType );
349349 }
350350
351351 // If file is not writable
352352 if (permissionsToCheck .contains ("w" ) && !file .canWrite ()) {
353- return context .getString (R .string .file_not_writable , fileType );
353+ return context .getString (R .string .error_file_not_writable , fileType );
354354 }
355355 // If file is not executable
356356 // This canExecute() will give "avc: granted { execute }" warnings for target sdk 29
357357 else if (permissionsToCheck .contains ("x" ) && !file .canExecute () && !ignoreIfNotExecutable ) {
358- return context .getString (R .string .file_not_executable , fileType );
358+ return context .getString (R .string .error_file_not_executable , fileType );
359359 }
360360
361361 return null ;
0 commit comments