/** @return the currentFileName (without extension) */ public static String getCurrentFileName() { if (AppSettings.isCustomFile() && !Utilities.IsNullOrEmpty(currentFileName)) { return Utilities.GetFormattedCustomFileName(currentFileName); } else { if (!Utilities.IsNullOrEmpty(currentFileName) && AppSettings.shouldPrefixSerialToFileName() && !currentFileName.contains(Utilities.GetBuildSerial())) { currentFileName = String.valueOf(Utilities.GetBuildSerial()) + "_" + currentFileName; } } return currentFileName; }
public static String GetFormattedCustomFileName(String baseName) { Time t = new Time(); t.setToNow(); String finalFileName = baseName; finalFileName = finalFileName.replaceAll("(?i)%ser", String.valueOf(Utilities.GetBuildSerial())); finalFileName = finalFileName.replaceAll("(?i)%hour", String.valueOf(t.hour)); finalFileName = finalFileName.replaceAll("(?i)%min", String.valueOf(t.minute)); finalFileName = finalFileName.replaceAll("(?i)%year", String.valueOf(t.year)); finalFileName = finalFileName.replaceAll("(?i)%month", String.valueOf(t.month + 1)); finalFileName = finalFileName.replaceAll("(?i)%day", String.valueOf(t.monthDay)); return finalFileName; }