relative-path

Fetch file from specific directory where jar file is placed

限于喜欢 提交于 2020-01-16 19:38:09
问题 I want to fetch a text file from the directory where my jar file is placed. Assuming my desktop application 'foo.jar' file is placed in d:\ in an installation of Windows. There is also a test.txt file in the same directory which I want to read when 'foo.jar' application is running. How can fetch that particular path in my 'foo.jar' application? In short I want to fetch the path of my 'foo.jar' file where it is placed. 回答1: Note, that actual code does depend on actual class location within

Fetch file from specific directory where jar file is placed

巧了我就是萌 提交于 2020-01-16 19:38:06
问题 I want to fetch a text file from the directory where my jar file is placed. Assuming my desktop application 'foo.jar' file is placed in d:\ in an installation of Windows. There is also a test.txt file in the same directory which I want to read when 'foo.jar' application is running. How can fetch that particular path in my 'foo.jar' application? In short I want to fetch the path of my 'foo.jar' file where it is placed. 回答1: Note, that actual code does depend on actual class location within

Using (relative) paths to shortcut in include statements in C++

一笑奈何 提交于 2020-01-14 14:04:27
问题 I started coding in C++ few days ago. I am using windows as my OS for writing code. I have been keeping all of my "well-written" codes in a single location. Now, I am working on a project that requires the use of those codes. So, I planned to include those files that I require as header files in my project. However, to make my project "self-contained", I created shortcuts of those folders that I require and kept them in the source folder of my new project and decided to use relative paths to

Convert Relative Path to Absolute Path

守給你的承諾、 提交于 2020-01-14 14:03:55
问题 I am trying to open a Help.txt file in windows Forms using a linkLabel. However unable to convert from absolute to relative path. First, I try to get the absolute path of the exe file. Which is successful. Second, get only directory of the exe file. Which is successful. Third, I am trying to combine the directory with the relative path of the Help.txt file. Which is unsuccessful. Exe file lives in -> \Project\bin\Debug folder, However the Help.txt file lives in \Project\Help folder. This is

Using (relative) paths to shortcut in include statements in C++

浪子不回头ぞ 提交于 2020-01-14 14:03:53
问题 I started coding in C++ few days ago. I am using windows as my OS for writing code. I have been keeping all of my "well-written" codes in a single location. Now, I am working on a project that requires the use of those codes. So, I planned to include those files that I require as header files in my project. However, to make my project "self-contained", I created shortcuts of those folders that I require and kept them in the source folder of my new project and decided to use relative paths to

Access relative path from eclipse-plugin

こ雲淡風輕ζ 提交于 2020-01-14 13:49:08
问题 Does anyone know how to get a file with uri from a self-made Eclipse Plug-in? Absolute paths would be no problem: URI.createFileURI("C:/Users/hp/workspace(dke)/SMartGen/StarSchema.profile.uml"); But how do I access local resources relatively? URI.createFileURI("jar:file:/%ECLIPSE_HOME%/plugins/SMartGen.jar!StarSchema.profile.uml"); doesn't work this way.... Happy for every answer. lg martin 回答1: Use the FileLocator. Example: URL iconUrl = FileLocator.find(Platform.getBundle("myBundle"), new

Is there a simple way to specify a WPF databinding where the path is one “level” up?

百般思念 提交于 2020-01-13 08:55:48
问题 This example is a admittedly a little contrived but I am doing something similar. Let's say I have the following simple classes: public class Person { public string Name { get; set; } public List<Alias> Aliases { get; set; } } public class Alias { public string AliasName { get; set; } } And let's say that I have Xaml with a LayoutRoot grid, and a DataGrid where I want to access the Name property within the DataGrid instead of the Aliases properties like in the second column here: <Grid x:Name

Absolute (or relative?) path in PHP

别等时光非礼了梦想. 提交于 2020-01-13 06:00:13
问题 Sorry for asking it as it may be answered many times before, but my question is little bit different I have tree like /var/www/path/to/my/app/ -- index.php -- b.php -- inc/ -- include.php (I'm accessing inc/include.php from index.php, include "inc/include.php"; ) but in include.php, I need to get absolute path to APPLICATION root, not DOCUMENT_ROOT so in result, I need to be able to use this command //inc/include.php include(APP_ROOT."/b.php"); repeating, I do NOT WANT TO CALL IT LIKE include

Absolute (or relative?) path in PHP

我是研究僧i 提交于 2020-01-13 06:00:09
问题 Sorry for asking it as it may be answered many times before, but my question is little bit different I have tree like /var/www/path/to/my/app/ -- index.php -- b.php -- inc/ -- include.php (I'm accessing inc/include.php from index.php, include "inc/include.php"; ) but in include.php, I need to get absolute path to APPLICATION root, not DOCUMENT_ROOT so in result, I need to be able to use this command //inc/include.php include(APP_ROOT."/b.php"); repeating, I do NOT WANT TO CALL IT LIKE include

Get relative path of a File path? [duplicate]

风格不统一 提交于 2020-01-11 06:42:30
问题 This question already has answers here : How to construct a relative path in Java from two absolute paths (or URLs)? (22 answers) Closed 3 years ago . I need to get the relative file path (relative to the program executable path) from a File object. What's the best way to do this? File offers only methods for the absolute path. Maybe getting execution path manually and then cut this path off from the absolute path to get a relative path? I am on Java 7, just in case java.nio has some helping