This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Feature Updates
 Completed Requests
 [COMPLETE] Customizable configuration files path
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

qwerty

Spain
5 Posts

Posted - 05/17/2012 :  08:34:45  Show Profile
I'm interested in the feature improve posted in http://www.strokesplus.com/forum/topic.asp?TOPIC_ID=291 , so even at the risk of being kicked in the butt for rising from the dead a thread , I suggest:

I periodically backup my useful files, and S+ config files are part of them. To achieve that, I make a copy of certain folder where all this files are auto-saved when the soft from they come support customization of the local path where they are stored. So, I'd like S+ be part of these programs that can divert their config files to another path different from core program files.
I know by the reading of the above linked thread that this is by now a pain to achieve in installation time, but what about a post-installation approach?
I'd like S+ could store/read its config files (one xml file I think) to/from an user explicit path in execution time.
You don't have to necessarily hard code it in the GUI, nor it has to be a fool-proof feature. This path parameter could be in a config.ini file stored in the installation path (core files path) or something similar. I don't mind to edit that file in text mode to insert a new path and get the essential config files diverted.

In resume, letīs say I store my other software config files in "d:\userpath". I'd love to be able to get this sequence working:
- Install S+ anywhere normally, if not installed yet, let's say "c:\Program Files\StrokesPlus\"
- Run S+ with the default config files to test it's working OK
- Edit something in S+ GUI or S+ installation path "c:\Program Files\StrokesPlus\config.ini" (or similar) to insert the config files custom path "d:\userpath\StrokesPlus configs\"
- Restart S+ or apply changes and now I can delete config files from installation path "c:\Program Files\StrokesPlus\" and S+ continue working ok with the config files from "d:\userpath\StrokesPlus configs\", and I'll backup them from there periodically (by myself).

Sorry for such a long post. I want to be sure I'm explaining enough.
Thanks in advance for your attention.

Please excuse my poor english... this is not my mother language.

Rob

USA
2615 Posts

Posted - 05/18/2012 :  11:15:01  Show Profile  Visit Rob's Homepage
I've added a simple function for allowing this in 1.9.1.

You can pass in the full path and name to StrokesPlus.xml via command line (or inside a shortcut). For example:

"C:\Program Files\StrokesPlus\StrokesPlus.exe" C:\Users\Rob\Config Files\StrokesPlus.xml

This will instruct S+ to load the config file C:\Users\Rob\Config Files\StrokesPlus.xml. StrokesPlus.lua and Language.xml will also be loaded from the same location (if present). ActionHelp.xml will be loaded from its normal location since it isn't really user-specific.

Now, to make this a quick update, I'm deriving the full path of StrokesPlus.lua and Language.xml from the parameter passed in. It's a pretty lame hack, but shouldn't give anyone who knows what they're doing a problem (and those are the only people I truly care about :P )

Here's what S+ does internally:

Is there ANYTHING in the command line?
+ If not, load all files in the same directory as StrokesPlus.exe
+ If yes (something was passed in)
 |- Assume the parameter is the direct path to StrokesPlus.xml (C:\Users\Rob\Config Files\StrokesPlus.xml)
 |- Replace ".xml" in the command line with ".lua" and attempt to load StrokesPlus.lua (not required)
 |- Replace "StrokesPlus.xml" with "Language.xml" and attempt to load the language file (not required)

So, if you pass in C:\Users\Rob\Config Files\StrokesPlus.xml, S+ will attampet to load:

C:\Users\Rob\Config Files\StrokesPlus.xml
C:\Users\Rob\Config Files\StrokesPlus.lua
C:\Users\Rob\Config Files\Language.xml

You don't need to put quotes around the parameter, S+ literally takes the whole command line, removed itself from it (C:\Program Files\StrokesPlus\StrokesPlus.exe), removes any quotation marks from the command line, then trim() what's left and assumes it's a full path and file name to StrokesPlus.xml.

Make sense?
Go to Top of Page

imafishimafish

USA
19 Posts

Posted - 05/18/2012 :  11:22:42  Show Profile
I like this. It will make updating S+ easier, I can just dump the whole zip file and not worry about preserving my customized files, they can stay safe in another location.

Rob, you may want to consider requiring quotes around the path. If you can just treat parameter 1 as the config path, it will make it easier to add other command line options in the future (without breaking someone's setup that doesn't use quotes). I don't know what other options you'd want, but I'm sure someone will come up with something.
Go to Top of Page

Rob

USA
2615 Posts

Posted - 05/18/2012 :  11:48:32  Show Profile  Visit Rob's Homepage
I thought about it, but in the end, any other options will always be in the config file, so this is all that should (I know, I know..) be needed, just to get S+ to the config where any future options/settings will reside.
Go to Top of Page

imafishimafish

USA
19 Posts

Posted - 05/18/2012 :  12:38:16  Show Profile
Fair enough.
One question, does acReloadConfig work with the new custom config file path? It doesn't seem to be reloading StrokesPlus.lua for me.

Edited by - imafishimafish on 05/18/2012 12:39:05
Go to Top of Page

qwerty

Spain
5 Posts

Posted - 05/18/2012 :  20:04:14  Show Profile
Working flawlessly here. Exactly what I asked for. THANKS !!

Side thoughts:
1- Command line parameter is a brilliant solution I hadn't thought of (I'm a text-mode fanatic and go straight for text config file approach, and the shotgun isn't always the best tool ). Instead, the command line parameter allow overwrite updates without the need to re-tweak that config file that certainly was owerwritten in the destructive update proccess. As imafishimafish pointed, now we can dump everything over and the path tweaking stays untouched in the shorcut. Well done.
2- I'm not a programmer, but I'm with imafishimafish about the quotes matter. I think he is right when looks at the future. This is the first parameter, but I'm pretty sure won't be the last. By the way, I'm not against quotes, but what about the usual /parameter way?
3- Rob, I'm not used to program versions (in fact, I'm not used to program anything ), but I think from now on you may have to keep in mind that some users like me will be using the same config files (xml, lua, and so on) between updates, so if you break any compatibility with the present syntax or structure of that files in future versions of S+, I kindly ask you to include that in changelogs, so we can make the appropiate changes in our side. Of course, I'm not telling you how to do your job, just giving you an observation that I think may be useful, with the best of intentions.
- acReloadConfig and Reload Config from taskbar icon menu "works ok" for me. Keep in mind that "works ok" means that no abnormal config changes, explosions or disasters happen. I don't know how to check the command returns to make sure the command was processed, and I don't make any config changes outside the GUI... anyway, I'm here to test whatever you need (if you teach me how...).

Another loooong post. I'm not able to summarize...thanks for your time and attention.

P.D: eeermm... can't we subscribe to this thread?

Edited by - qwerty on 05/18/2012 20:10:57
Go to Top of Page

Rob

USA
2615 Posts

Posted - 05/19/2012 :  02:27:56  Show Profile  Visit Rob's Homepage
quote:
Originally posted by imafishimafish

Fair enough.
One question, does acReloadConfig work with the new custom config file path? It doesn't seem to be reloading StrokesPlus.lua for me.



Hmm, I'm not able to reproduce that. It's possible this was an existing Lua state issue(?); perhaps you're making updates to functions and the Lua state isn't overwriting them; fully possible, but I'm a few beers deep at the moment, so my analyses are limited =) Would you mind giving me a little more details?

qwerty:

2. If someone can point out to me a valid reason why more command parameters would ever be a necessity, I'd surely reconsider =) But the only thing that I can see which matters is getting S+ to the config, everything/anything else can be a value in the config, even if it's just a small/temporary/migration setting, the config is the central point of processing for everything, so once S+ has it, that's all that really matters. I completely understand the apprehension as it seems like simply a poor design choice, but there is nothing that would ever be needed that cannot be in the config, so S+ just needs to know how to find it; even if I added the ability to recognize paths within the config to point to other files..it can all still be in the config.
3. I will never knowingly break compatibility. The only matter which would do so at this point is (the open, and confirmed demand of) assigning multiple gestures to an action as it would require additional child elements to store each gesture, as opposed to the single element now. However, should the time come for a rewrite of the S+ UI, I fully intend to make this a seamless transition, where S+ examines the node and sees that it's using the old format and moves the gestures into the new child node. So you folks would never be affected in any way.

The Change Log is provided from the base of the forum, and updated each release: http://www.strokesplus.com/ChangeLog.txt
Go to Top of Page

Rob

USA
2615 Posts

Posted - 05/19/2012 :  02:29:16  Show Profile  Visit Rob's Homepage
Oh, the default when I make a new forum category is "No Subscriptions".. I've updated this and the CLosed/Deferred Requests one to allow this.
Go to Top of Page

imafishimafish

USA
19 Posts

Posted - 05/19/2012 :  18:20:08  Show Profile
quote:
Originally posted by Rob
Hmm, I'm not able to reproduce that. It's possible this was an existing Lua state issue(?); perhaps you're making updates to functions and the Lua state isn't overwriting them; fully possible, but I'm a few beers deep at the moment, so my analyses are limited =) Would you mind giving me a little more details?


Yeah, it might be an existing Lua state issue. I just started using the StrokesPlus.lua file and had it in a customized path, so I guessed that it might be related to the problem. So, if S+ is running, and I make a change to a function in StrokesPlus.lua, and then run an action that calls acReloadConfig. I don't see my changes to the function until I restart S+ completely.
Go to Top of Page

Rob

USA
2615 Posts

Posted - 05/19/2012 :  18:33:02  Show Profile  Visit Rob's Homepage
Ah, yep. I see it now.

Try clicking Reload Config from the tray icon and let me know if that works. Turns out acReloadConfig is only reloading the CONFIG settings (XML tree), but doesn't touch the Lua state, where Reload Config from the tray icon does both.

I tried to have it also reload the Lua state, but it crashes because it's closing the Lua state while a call is in progress... So for StrokesPlus.lua changes, you'll have to reload from the tray icon (which is only making internal calls [not inside the active Lua state/engine]). That's what I was doing and was unable to reproduce, didn't try the action.

While unintentional (as I too would think acReloadConfig would also reload StrokesPlus.lua), it turns out I did document acReloadConfig only mentioning StrokesPlus.xml =) Maybe I actually tried to reload the state before and met the same crash results and I just don't remember.
Go to Top of Page

imafishimafish

USA
19 Posts

Posted - 05/20/2012 :  18:37:29  Show Profile
That makes perfect sense why you can't reload the Lua state in the middle of an action. I thought I had tried "Reload Config" from the tray icon, but I guess not, because that works fine. Sorry for the wild goose chase.
Go to Top of Page

dantist

5 Posts

Posted - 05/15/2014 :  09:52:58  Show Profile
I put the files on OneDrive which works pretty well. Actually I only need StrokesPlus.xml there, but then S+ throws an error ("Failed to load/parse ActionHelp.xml"). Closing the errow message and opening S+ crashes the application.
Go to Top of Page

Rob

USA
2615 Posts

Posted - 05/16/2014 :  16:11:51  Show Profile  Visit Rob's Homepage
I would recommend copying StrokesPlus.lua and ActionHelp.xml to the same location as StrokesPlus.xml
Go to Top of Page

dantist

5 Posts

Posted - 05/20/2014 :  15:48:33  Show Profile
I had an issue today, not sure if it's related to the shared configuration files. When I opened the S+ settings, all Lua scripts had lost their line breaks. Gestures where still working though, but when I hit "apply" without changing anything, all gestures where broken.

I think I'll go back to local config files for now.
Go to Top of Page

Hard.Wired

84 Posts

Posted - 06/11/2018 :  13:42:52  Show Profile
What is the best way to find the path of where the user loaded the custom settings files? I don't see any variable set by StrokesPlus.
Go to Top of Page

Rob

USA
2615 Posts

Posted - 06/11/2018 :  15:16:51  Show Profile  Visit Rob's Homepage
There is no built-in ability to determine the location. The only thing I can think of is to create a StrokesPlus.lua file in the same folder as the custom settings file. In that Lua file, create a function that returns a value that you can call from other scripts to indicate the location. Could probably just create a variable in that file/script instead of a function.
Go to Top of Page

Hard.Wired

84 Posts

Posted - 06/11/2018 :  19:23:11  Show Profile
Yeah, I was hoping for a simple programmable solution. I'll use a variable for now. Thanks!

Edited by - Hard.Wired on 06/11/2018 19:24:52
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000