Home > Posts > HowTo: Get and combine executable path with subfolder and filename

HowTo: Get and combine executable path with subfolder and filename

Based on others answers at

http://stackoverflow.com/questions/3123870/find-the-location-of-my-applications-executable-in-wpf-c-or-vb-net

here’s an example that shows how to remove the executable name from the path and combine the result with some subfolder and filename:

At my updated version of Hotspotizer (http://github.com/birbilis/Hotspotizer), I’ve just added support for loading a Gesture Collection file at startup, if found at Library\Default.hsjson, by using the following code:

const string GESTURE_COLLECTION_LIBRARY_PATH = "Library"
const string DEFAULT_GESTURE_COLLECTION = "Default.hsjson"

//...

LoadGestureCollection(
  Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),
  GESTURE_COLLECTION_LIBRARY_PATH,
  DEFAULT_GESTURE_COLLECTION));
  1. No comments yet.
  1. No trackbacks yet.

Leave a comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.