chelh / VBASync

Cross-platform tool to synchronize macros from an Office VBA-enabled file with a version-controlled folder
Other
161 stars 46 forks source link

Manage relative path in recent items #14

Closed hectorticoli closed 7 years ago

hectorticoli commented 7 years ago

Hello chelh,

Now that you almost fixed my last enhancement request, I thought of another one ^^. I would use a setting to save recent list item as relative path (relative from the application folder).

Ideally, that would manage relative path like ..\Sessions\SessionFile.ini (if the file is located in a folder next to the VBASync folder), or just relative folder from the application folder (like SessionFile.ini or Sessions\SessionFile.ini for a file located in a subfolder named Sessions). In short, that's the DOS way to define relative path.

You could either specify an option (in VBASync.ini file for example), or detect if the folder is relative or not (better if possible ^^).

And thanks again, you're always pretty efficient in taking my requests into account

chelh commented 7 years ago

Okay, so let's say you have the .exe in D:\VBASync\. I think it shouldn't be too hard for me to detect and use a relative path for D:\VBASync\session.ini or D:\VBASync\Sessions\session2.ini. It would be harder to detect and use a relative path for D:\VBASync Sessions\session3.ini, and that also seems like a much more niche request. How about I cover the first two scenarios, but not the third? Would that still be just as useful?

hectorticoli commented 7 years ago

For immediate use, the first 2 scenario should be enough. However, I think you could consider something like this : 1) Test the path as absolute path 2) Test the path as relative path using code like this var absolute_path = Path.Combine([ApplicationFolder], "..\images\image.jpg"); (picked from http://stackoverflow.com/questions/4796254/relative-path-to-absolute-path-in-c). I think this already covers all tricky cases about relative paths.

3) if the 2 failed, then the file couldn't be found and should be ignored (or deleted?, see next)

I can't decide in this case if that would be smart to automatically delete the path from the recent item list. Maybe you could use the same behavior as Visual Studio, that is check if the file exists only if the user try to load the file, and if the file can't be found, ask if the user want to delet the entry.

I didn't test the code myself, but as this is in .Net main code, that should work ^^

chelh commented 7 years ago

Here's a new version for testing: Portable VBA Sync Tool 1.3.0.zip

hectorticoli commented 7 years ago

Sorry for being "late", I had Internet access problem recently. I tested that new version. Apart from the french resource file that I updated (see corresponding discussion), everything seems OK as far as I remember. I think that as far as I'm concerned, version 1.3.0 is ready for release.

chelh commented 7 years ago

VBA Sync Tool 1.3.0 is now released!