relative-path

Loading image from relative path in Windows Forms

风流意气都作罢 提交于 2019-11-27 02:06:49
I have an image in my application and i have a picture in my winforms public static string Correct_Icons = @"C:\Users\xyz\Documents\Visual Studio 2008\Projects\FileShareMgmt\FileShareMgmt\Resources\Correct.png"; public static string warning_Icon = @"C:\Users\xyz\Documents\Visual Studio 2008\Projects\FileShareMgmt\FileShareMgmt\Resources\Warning.png"; cell.Value = Image.FromFile("Resources/warning_Icon); but i want just want the relative path and not the full path. eg i want this public static string Correct_Icons = "\Resources\Correct.png"; and cont. ..../ not working agent-j For my program,

How to rewrite urls of images in vendor CSS files using Grunt

谁都会走 提交于 2019-11-27 01:51:35
问题 I am trying to move frontend dependencies out of the version control system. A combination of Bower.io and Grunt should be able to do this. A problem however occurs that I am yet unable to solve with bundling multiple vendor libraries. For example assume I have the following directory structure where the components directory is the directory that Bower.io saves the dependencies in: ├── assets └── components ├── bootstrap │ ├── img │ │ └── glyhs.gif │ └── less │ └── bootstrap.css └── jquery-ui

Is there a way to setup Linked Resources relative to the .project file?

a 夏天 提交于 2019-11-27 00:44:44
问题 We have a Flash Builder (which is based on Eclipse) project that pulls source from different locations, included in the source control in which the project is. As per our organization requirements, the source code is present in directories not directly under the project directory. Initially we had the problem that all paths to the linked resources were absolute and did not work on other machines with different paths. Right now, the solution we have for this is to set up a Linked Resource Path

Java - Loading dlls by a relative path and hide them inside a jar

孤街浪徒 提交于 2019-11-26 22:33:30
PART 1 I am developing a Java application that should be release as a jar. This program depends on C++ external libraries called by JNI. To load them, I use the method System.load with an absolute path and this works fine. However, I really want to "hide" them inside the JAR, so I have created a package to collect them. This forces me to load an relative path - the package path. By this approach, I let the user run the JAR in any directory, without being worried about linking the DLLs or bored with a previous installation process. This throws the expected exception: Exception in thread "main"

How to accomplish relative import in python

柔情痞子 提交于 2019-11-26 22:23:20
问题 stuff/ __init__.py mylib.py Foo/ __init__.py main.py foo/ __init__.py script.py script.py wants to import mylib.py This is just an example, but really I just want to do a relative import of a module in a parent directory. I've tried various things and get this error... Attempted relative import beyond toplevel package I read somewhere that the script from where the program starts shouldn't in the package, and I tried modifying the structure for that like so... stuff/ mylib.py foo.py //

How to use Server.MapPath to get location outside website folder in ASP.NET

倖福魔咒の 提交于 2019-11-26 21:34:05
问题 When my ASP.NET site uses documents (e.g. XML), I normally load the document as follows: Server.MapPath("~\Documents\MyDocument.xml") However, I would like to move the Documents folder out of the website folder so that it is now a sibling of the website folder. This will make maintaining the documents considerably easier. However, rewriting the document load code as follows: Server.MapPath("../../Documents/MyDocument.xml") results in a complaint from ASP.NET that it cannot 'exit above the top

php nested include behavior

一世执手 提交于 2019-11-26 21:25:00
问题 In many places in my code, I do things like: file1.php: <?php include('../file2.php'); file2.php: <?php include('anotherdirectory/file3.php'); Depending on the server or settings I try this on, it either sets the relative paths from the "includer" or from the "includee". This is really confusing. So file1 might try to include "../anotherdirectory/file3.php" or it might try "anotherdirectory/file3.php". What settings dictate this behavior? I want to have control over this... 回答1: In cases when

Open file in a relative location in Python

南笙酒味 提交于 2019-11-26 21:23:42
Suppose python code is executed in not known by prior windows directory say 'main' , and wherever code is installed when it runs it needs to access to directory 'main/2091/data.txt' . how should I use open(location) function? what should be location ? Edit : I found that below simple code will work..does it have any disadvantages ? file="\2091\sample.txt" path=os.getcwd()+file fp=open(path,'r+'); With this type of thing you need to be careful what your actual working directory is. For example, you may not run the script from the directory the file is in. In this case, you can't just use a

How to get the absolute path for a given relative path programmatically in Linux?

蹲街弑〆低调 提交于 2019-11-26 20:24:16
问题 How to get the absolute path for a given relative path programmatically in Linux? Incase of Windows we have the _fullpath() API. In other words, I mean what is analogous API to _fullpath of Windows in Linux? 回答1: As Paul mentioned, use realpath() . Please note though, that since many file systems in Linux support hard links, any given directory can have a number of different absolute paths. 回答2: Check out the realpath function. #include <stdlib.h> #include <stdio.h> #include <linux/limits.h>

How to make an “always relative to current module” file path?

喜欢而已 提交于 2019-11-26 20:18:23
问题 Let's say you have a module which contains myfile = open('test.txt', 'r') And the 'test.txt' file is in the same folder. If you'll run the module, the file will be opened successfully. Now, let's say you import that module from another one which is in another folder. The file won't be searched in the same folder as the module where that code is. So how to make the module search files with relative paths in the same folder first? There are various solutions by using " __file__ " or " os.getcwd