Stay organized w/ this fancy String function!

edited June 2015 in Share Your Work

Doing some sketch folder cleaning after finding some bloated ones, full of saved frames/etc. Now I'm storing all renderings into an "_output/" folder within the Documents/Processing/, so if a sketch is duplicated, copied, shared- it won't come with all the weight of test outputs.

It's a pretty dumb/simple function that's sadly taken me years implement. Perhaps it's useful for someone else who's had the same issue:

String outputPath(String format){  
  String outputFolder = "_output/";
  String date = new java.text.SimpleDateFormat("yy_MM_dd_kkmmss_S").format(new java.util.Date ()); 
  String[] sketchSplit = split(sketchPath(""), "Processing/");
  return sketchSplit[0]+"Processing/"+outputFolder+sketchSplit[1]+getClass().getSimpleName()+"_"+date+format;
}

example usage somewhere in code:

saveFrame(outputPath(".jpg")); // .jpg, .png, .tiff, .pdf ... or blank!?
println(outputPath(".pdf"));

Comments

  • Does this mean all sketches magical use the same folder for their output?

    thanks for your research!

    ;-)

  • Indeed- in this case the folder is called '_output/' but you can change that to whatever you like at the top of the function.

    The structure is then

    '_output/[extra_folder_to_sketch]/sketchname/sketchname_date.format'

    It takes away the joy of hitting 'CMD+K' to quickly open the folder and view output... but if you open the output folder once, then it's not bad.. and oh so helpful for when I duplicate+alter a sketch versus versioning it.

Sign In or Register to comment.