Пример #1
0
 public void warn(String message) {
   try {
     Warning.warning(this, false, false, message);
   } catch (IOException e) {
     throw new EvalException(e);
   }
 }
Пример #2
0
  @Internal("file.create")
  @DataParallel
  public static boolean fileCreate(
      @Current Context context, @Recycle String fileName, @Recycle(false) boolean showWarnings)
      throws IOException {
    try {
      FileObject file = context.resolveFile(fileName);
      // VFS will create the parent folder if it doesn't exist,
      // which the R method is not supposed to do
      if (!file.getParent().exists()) {
        throw new IOException("No such file or directory");
      }
      file.getContent().getOutputStream().close();
      return true;

    } catch (Exception e) {
      if (showWarnings) {
        Warning.invokeWarning(
            context, "cannot create file '%s', reason '%s'", fileName, e.getMessage());
      }
      return false;
    }
  }