Thursday, February 7, 2013

ssClasses Image Location Poll


MK has emailed me ssClasses with one change, i.e., GETENV("TMP") is replaced with CURDIR().  However, my CURDIR() is my folder for my tables named records.  So implementing this will result to something like this:

\\myserver\myappfolder\records\clocks
\\myserver\myappfolder\records\close
\\myserver\myappfolder\records\switches 
and so on...

I cannot deny that MK really needs it like that.  However, personally, one of the reasons why I throw those images in temp folder is because I do not want my app cluttered with any of those.  But that is my personal choice.  ssClasses library no longer affects me or MK alone so I wanted your opinions as well on this.

An alternative I am thinking is this, create a public empty class in your topmost prg like this:

PUBLIC ossClassLib
ossClassLib = CREATEOBJECT('EMPTY')
ADDPROPERTY(ossClassLib,'ImagePath',GETENV("APPDATA"))

So you can control where the images will go.

I prefer an empty class over a public variable as it is less prone to affect your other variable declarations in your project.  Plus maybe in the future we will need some more of the same so all I need to do then is simply add another property to it.

Inside the class for extracting images will be something like:
STRTOFILE(STRCONV(m.lcImage1,14),ADDBS(ossClassLib.ImagePath)+'Close\BlueBar1.skz',0)

Or is there something better than that?

Another is the issue of overwriting only the images when it is not there.  Would you rather I remove skipping of extraction when the image is there or would I retain it?  If we retain it, then images won't be extracted anymore when it is there and it will be a bit faster (nanosecond difference?).  That is the PRO.  The CON is if I make any changes to the images, then those that are on your client's side won't be updated as long as those old images exist.  That is the main reason why ss_support.app simply replaces images on every run.

Two questions:
1.  Do I go for fixed CURDIR() or do we use Empty Class for image location?
2.  Do I check for images and skips overwriting if it is there or I simply overwrite it on every form run?  You won't know overwriting is done as it is very fast (nanosecond).

If you are interested to participate, please post your opinions below.  Alpha 4 will be based on your opinions.  And the sooner you can respond to this, the sooner I can touch the library.


2 comments:

  1. Hi Jun,

    How about an include file, something like SSCLASSES_CONFIG.H. You could do something like this in the .H file:

    #DEFINE SSC_IMAGE_PATH_LOCATION "GETENV('TMP')"

    Then use code like this to get the path (sorry about the formatting):
    #INCLUDE SSCLASSES_CONFIG.H

    TRY
    lcImagePath = EVALUATE( SSC_IMAGE_PATH_LOCATION )
    IF NOT VARTYPE( m.lcImagePath ) = "C" ;
    OR EMPTY( m.lcImagePath )
    ERROR "No user-defined image path."
    ENDIF
    CATCH
    lcImagePath = GETENV("TMP")
    ENDTRY

    A developer only has to edit the .H file and recompile to retrieve the path from anywhere:
    #DEFINE SSC_IMAGE_PATH_LOCATION "_VFP.oAppSettings.ImageFilesFolder"
    #DEFINE SCC_IMAGE_PATH_LOCATION "GetTempFilesFolder()"

    Hopefully that gives you some more ideas.

    ReplyDelete
  2. Hello Mike! I will wait for some more comments here and in foxite forum before I act on any change. Thanks!

    ReplyDelete