relative-path

How can I get MSBUILD to evaluate and print the full path when given a relative path?

半城伤御伤魂 提交于 2019-11-28 18:31:53
How can I get MSBuild to evaluate and print in a <Message /> task an absolute path given a relative path? Property Group <Source_Dir>..\..\..\Public\Server\</Source_Dir> <Program_Dir>c:\Program Files (x86)\Program\</Program_Dir> Task <Message Importance="low" Text="Copying '$(Source_Dir.FullPath)' to '$(Program_Dir)'" /> Output Copying '' to 'c:\Program Files (x86)\Program\' Roman Starkov In MSBuild 4.0 , the easiest way is the following: $([System.IO.Path]::GetFullPath('$(MSBuildThisFileDirectory)\your\path')) This method works even if the script is <Import> ed into another script; the path

How to open my files in data_folder with pandas using relative path?

寵の児 提交于 2019-11-28 17:52:51
问题 I'm working with pandas and need to read some csv files, the structure is something like this: folder/folder2/scripts_folder/script.py folder/folder2/data_folder/data.csv How can I open the data.csv file from the script in scripts_folder ? I've tried this: absolute_path = os.path.abspath(os.path.dirname('data.csv')) pandas.read_csv(absolute_path + '/data.csv') I get this error: File folder/folder2/data_folder/data.csv does not exist 回答1: Try import pandas as pd pd.read_csv("../data_folder

Codeigniter - dynamically getting relative/absolute path outside of application folder

隐身守侯 提交于 2019-11-28 17:27:20
I am attempting to have a temporary cache folder of sorts just outside of and at the same level as the application folder. This is for storing images for a couple moments before moving them off-site. I am trying to get a user's Facebook profile image and save it to my server. I have an image storage solution which requires me to take the photo, and rename it then pass it to the respective location for storage. My thoughts were using file_get_contents() and file_put_contents() I could store this file for a moment while processing it accordingly and then copy/move it to my storage method.

How to construct a WebSocket URI relative to the page URI?

本小妞迷上赌 提交于 2019-11-28 16:46:47
I want to construct a WebSocket URI relative to the page URI at the browser side. Say, in my case convert HTTP URIs like http://example.com:8000/path https://example.com:8000/path to ws://example.com:8000/path/to/ws wss://example.com:8000/path/to/ws What I'm doing currently is replace the first 4 letters "http" by "ws", and append "/to/ws" to it. Is there any better way for that? kanaka If your Web server has support for WebSockets (or a WebSocket handler module) then you can use the same host and port and just change the scheme like you are showing. There are many options for running a Web

Visual Studio: Relative Assembly References Paths

风流意气都作罢 提交于 2019-11-28 15:56:26
When adding a reference to an assembly located within the solution directory, is there any way to add it relatively, so that when checked in and out of a repository it is referenced in projects correctly? CrimsonX To expand upon Pavel Minaev's original comment - The GUI for Visual Studio supports relative references with the assumption that your .sln is the root of the relative reference. So if you have a solution C:\myProj\myProj.sln , any references you add in subfolders of C:\myProj\ are automatically added as relative references. To add a relative reference in a separate directory, such as

~/ equivalent in javascript

元气小坏坏 提交于 2019-11-28 15:46:17
问题 Any smart way of doing a "root" based path referencing in JavaScript, just the way we have ~/ in ASP.NET? 回答1: Have your page generate a tag with something like: <link rel="home" id="ApplicationRoot" href="http://www.example.com/appRoot/" /> Then, have a function in JavaScript that extracts the value such as: function getHome(){ return document.getElementById("ApplicationRoot").href; } 回答2: Use base tag: <head> <base href="http://www.example.com/myapp/" /> </head> ... from now any link use on

relative path in BAT script

社会主义新天地 提交于 2019-11-28 13:43:04
问题 Here is my own program folder on my USB drive: Program\ run.bat bin\ config.ini Iris.exe library.dll etc. I would like to use run.bat to start Iris.exe I cannot use this: F:/Program/bin/Iris.exe like a shortcut, because sometimes it does not attach as drive F: ( e.g. E: or G: ) What do I need to write in the bat file to work regardless of the drive letter? I tried this in the BAT file: "\bin\Iris.exe" But it does not work. 回答1: Use this in your batch file: %~dp0\bin\Iris.exe %~dp0 resolves to

Relative Paths in Winforms

霸气de小男生 提交于 2019-11-28 10:10:21
Relative paths in C# are acting screwy for me. In one case Im handling a set of Texture2d objects to my app, its taking the filename and using this to locate the files and load the textures into Image objects. I then load an image from a relative path stored in the class file and use a relative path that needs to be relative to Content/gfx. But if i dont load these textures these relative paths will fail. How can I garuantee that my rel path wont fail? In web work all rel paths are relative to the folder the file we're working from is in, can I set it up this way and make all rel paths to root

How to use fstream objects with relative path?

拈花ヽ惹草 提交于 2019-11-28 08:59:19
Do I always have to specify absolute path for objects instantiated from std::fstream class? In other words, is there a way to specify just relative path to them such as project path? You can use relative paths as well. But they are relative to the environment you call your executable from. This is OS dependent but all the major systems behave more or less the same AFAIK. Windows example: // File structure: c:\folder\myprogram.exe c:\myfile.txt // Calling command from folder c:\folder > myprogram.exe In the above example you could access myfile.txt with "c:/myfile.txt" or "../myfile.txt". If

Angular2 relative paths for templateUrl and styleUrls?

落花浮王杯 提交于 2019-11-28 08:50:36
While searching I found something named as moduleId to set the relative paths of template and CSS files, but I don't know exactly how to use moduleId in our components of angular2? Actually, the problem is in my folder structure.I am loading my all .js files from dist folder whereas my view(.html files) are in the src folder. So when I use moduleId: module.id like this angular took the path from dist folder, instead of src folder. So anybody here helps me tell that How to set custom moduleId for my component angualr2? My folder structure like this. App /\ / \ (.js + .map files)Dist Src(.ts +