public static String maybeTruncateFilename(String barefilename) {
    if (((Boolean)(Stella.$DONTTRUNCATEFILENAMESp$.get())).booleanValue()) {
      return (barefilename);
    }
    { int maximumlength = 999;

      if (Stella.$OS$ == Stella.KWD_MAC) {
        maximumlength = 31 - 5;
      }
      else {
      }
      if (barefilename.length() > maximumlength) {
        { String originalfilename = barefilename;

          barefilename = Native.string_subsequence(barefilename, 0, maximumlength - 1);
          {
            Stella.STANDARD_WARNING.nativeStream.println("Warning: Truncating name of file.");
            Stella.STANDARD_WARNING.nativeStream.println("   Original: `" + originalfilename + "'    Truncated: `" + barefilename + "'");
            Stella.STANDARD_WARNING.nativeStream.println();
          }
;
        }
      }
      return (barefilename);
    }
  }