On Fri, Jul 3, 2015 at 5:56 PM, Richard Gaskin <ambassa...@fourthworld.com>
wrote:

> A mainstack has a filename property, which can be set from the value
> returned from "ask file".  Follow that with a save command and you're done.


Wow.  That easy.  And it turns out that save can even take a filename
argument . . .

So it now slices & dices quite nicely.

I then made two more procedures to help update/move along.

My files end up with path/names like

someBaseDir/yymm/yymmdd/baseProgName.yymmdda.livecode


where the "a" in the advancing letter subversion.

So this procedure now bumps the version without leaving the ice


*on* bmpVrsn

   *--bump the version by a letter*



   *local* oldFlNm, newFlNm

   *save* this stack


   *put* the filename of stack (the mainstack of this stack ) into newFlNm

   *put* numToChar(charToNum(char -10 of newFlNm)+1) into char -10 of
newFlNm

   *save* this stack as newFlNm



*end* bmpVrsn


and this one is for when it opens, to see if it's new day, and to make any
needed directories and but the name:

*on* ckVersDat

   *--to be used when opening.   Change the file if it is not from today*



   *local* today, year, month, day

   *local* oldYear, oldMonth, oldDay

   *local* oldFilNm, newFilNm



   *put* the long date into today

   *convert* today to dateitems



   *put* char 3 to 4 of the first item of today into year

   *put*  char -2 to -1 of ("0" & item 2 of today) into month

   *put* char -2 to -1 of ("0" & item 3 of today) into day



   *put* year & month & day into today



   *put* the fileName of stack (the mainStack of this stack) into oldFilNm



   *--figure out the old file dates*

   *set* the itemDel to "/"



   *if* item -2 of oldFilNm = today *then*

      *--it is the same day*

     * exit ckVersDat*

   *end* *if*





   *put* char 1 to 2 of item -2 of oldFilNm into oldYear

   *put* char 3 to 4 item -2 of oldFilNm into oldMonth

   *put* char 5 to 6 of item -2 of oldFilNm into oldDay



   *put* item 1 to -4 of oldFilNm & "/" & year & month into newFilNm

   *if* there is not a folder newFilNm *then*

      *create* folder newFilNm

   *end* *if*



   *put* "/" & today after newFilNm

   *if* there is not a folder newFilNm *then*

      *create* folder newFilNm

   *end* *if*



   *put* "/" & char 1 to -17 of item -1 of oldFilNm & today & "a.livecode"
after newFilNm

   *if* there is not a file newFilNm *then*

      *save* this stack as newFilNm

   *else*

      *get* dhbkAnswr ("There is already a file", newFilNm)

   *end* *if*

*end* ckVersDat


Now I just need to find the routine to cause a standalone to compile . . .

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462
_______________________________________________
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode

Reply via email to