fullRuntime/src/sc/util/FileUtil.java
public static void saveStringAsReadOnlyFile(String fileName, String data, boolean mkdirs) {
      File file = new File(fileName);
      if (file.canRead()) {
         if (file.canWrite()) {
            file.renameTo(new File(fileName + "_savedEdits"));
         }
         else
            file.setWritable(true);
      }
      FileUtil.saveStringAsFile(file, data, mkdirs);
      file.setReadOnly();
   }
/**
    * For files we generate, mark them as 'read only' to avoid accidentally modifying them and as a signal to the editor and IDE.
    * We also can use this flag as another hint as to whether the file has been edited accidentally.
    */
For files we generate, mark them as 'read only' to avoid accidentally modifying them and as a signal to the editor and IDE.
We also can use this flag as another hint as to whether the file has been edited accidentally.
For files we generate mark them as ' read only ' to avoid accidentally modifying them and as a signal to the editor and IDE . We also can use this flag as another hint as to whether the file has been edited accidentally .
public static void saveStringAsReadOnlyFile(String fileName, String data, boolean mkdirs) {
      File file = new File(fileName);
      if (file.canRead()) {
         if (file.canWrite()) {
            file.renameTo(new File(fileName + "_savedEdits"));
         }
         else
            file.setWritable(true);
      }
      FileUtil.saveStringAsFile(file, data, mkdirs);
      file.setReadOnly();
   }
public static void saveStringAsReadOnlyFile ( String fileName , String data , boolean mkdirs ) { File file = new File ( fileName ) ; if ( file . canRead ( ) ) { if ( file . canWrite ( ) ) { file . renameTo ( new File ( fileName + "_savedEdits" ) ) ; } else file . setWritable ( true ) ; } FileUtil . saveStringAsFile ( file , data , mkdirs ) ; file . setReadOnly ( ) ; }
For files we generate, mark them as 'read only' to avoid accidentally modifying them and as a signal to the editor and IDE.
For files we generate mark them as ' read only ' to avoid accidentally modifying them and as a signal to the editor and IDE .