File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1300,6 +1300,18 @@ inline unsigned long millis() {
13001300 static auto start = steady_clock::now ();
13011301 return static_cast <unsigned long >(duration_cast<milliseconds>(steady_clock::now ()-start).count ());
13021302}
1303+ // sketchPath/dataPath -- returns path relative to sketch folder
1304+ inline ::std::string sketchPath (const ::std::string& where=" " ) {
1305+ const char * p = ::std::getenv (" PROCESSING_SKETCH_PATH" );
1306+ ::std::string base = p ? p : " ." ;
1307+ return where.empty () ? base : base + " /" + where;
1308+ }
1309+ inline ::std::string dataPath (const ::std::string& where=" " ) {
1310+ return sketchPath (where.empty () ? " data" : " data/" + where);
1311+ }
1312+ inline ::std::string sketchFile (const ::std::string& where) { return sketchPath (where); }
1313+ inline ::std::string dataFile (const ::std::string& where) { return dataPath (where); }
1314+
13031315inline int second () { ::std::time_t t=::std::time (nullptr ); return ::std::localtime (&t)->tm_sec ; }
13041316inline int minute () { ::std::time_t t=::std::time (nullptr ); return ::std::localtime (&t)->tm_min ; }
13051317inline int hour () { ::std::time_t t=::std::time (nullptr ); return ::std::localtime (&t)->tm_hour ; }
You can’t perform that action at this time.
0 commit comments