FAQ Database Discussion Community


jQuery plugin making a API url relative to included js file rather than host

jquery,api,relative-path
Hi currently I am working on a jQuery plugin in which I make an API call. Rather than hard coding the URL for the API, I would like it to be relative in terms of the URL of the JS file of the plugin So say I have the following...

Copy relative paths of some files and other files in subdirectories to a text file

powershell,cmd,relative-path
I have a folder named source. It has some jpeg files and some subdirectories containing further jpeg files. I want to copy relative paths of all the files and other files in subdirectories in a text document "test.txt". For example, I have files, a.jpg b.jpg c.jpg and subdirectories sub1/d.jpg sub2/e.jpg...

Batch - Resolve relative path

windows,batch-file,cmd,relative-path
My batch scripts are located in the following directory: \\test\public\windows\scripts\32\test.bat I'm trying to get the path of this folder: \test\public\windows\logs I've tried using %~dp0 in order to get the path of the script, and i've tried: SET REL_PATH=..\..\ The thing is that it's not showing me this folder....

Nginx rewrite error with including files in index.php

javascript,css,.htaccess,nginx,relative-path
I had an apache webserver where I justed a htaccess. I switched to NGINX and I did the NGINX configuration. My rewrite is as followed: location /mvc/public { index index.php; try_files $uri $uri/ @rewrite; } location @rewrite{ rewrite ^/mvc/public/(.*)$ /mvc/public/index.php?url=$1; } This works properly but now the other files I...

How to use a path relative to project root to H2 db-file configuration with Play Framework 2.4?

jdbc,h2,relative-path,persistent,playframework-2.4
We're developing a Play 2.4 application (Java API). For dev purposes, we'd like to use a persistent H2 database with DB file path relative to the project root directory. In How to use a persistent H2 database in the Play Framework instead of in-memory there was solution for Play 2.0:...

Referencing file from realpath PHP

php,ftp,relative-path,filepath,realpath
I have a class that handles FTP stuff located here: /var/www/html/crm/rhinos/classes/ftp.php This class is included in a script that generates a spreadsheet here: /var/www/html/crm/send_cust_lock.php The generated spreadsheet is located here: /var/www/html/crm/tmp/cust_lock_1430424215.xlsx My class contains the following method: public function put($filepath){ $fp = fopen($filepath, 'r'); $z = ftp_fput($this->connection, $filepath, $fp, FTP_BINARY);...

Java Hardcoded Relative Path to File [duplicate]

java,relative-path
This question already has an answer here: How to read text file from relative path in a project? 6 answers I have written some code that relies on another project that I have included in my build path. The issue I am having is that the other project has...

File.getAbsoluteFile() return “/” in unix shell execution

java,unix,relative-path,launchd
I'm using File.getAbsoluteFile() in order to build a relative path to the resources folder. While I'm executing the code within IDE - works great. I've compiled a jar file, and executing it trough script within terminal - works great. In both cases I'm getting correct relative path : "/Users/ie54553/Desktop/MyProject/" I've...

Relative Path when creating Bitmap

c#,wpf,bitmap,relative-path
I am trying to create a Bitmap using: bitmap = new Bitmap(@"Movies\View\Images\missing_person.bmp"); However, I am receiving a System.ArgumentException error. The file I'm calling the above code from is located in: MyProj\DisplaySideBarCommand.cs The images are in: MyProj\Movies\View\Images\missing_person.bmp I also tried using: bitmap = new Bitmap(@"..\Movies\View\Images\missing_person.bmp"); but received the same error....

Relative path with fstream c++

c++,file,relative-path,fstream
I try to load a file with fstream. The code looks like this file.open("../levels/level0.lvl"); if (file.is_open()) { while (!file.eof()) { std::getline(file, Str); list = ReadLine(Str, list); } } But it loads nothing. Yes only if the path is absolute. How can I make the path relative? The folder "levels" is...

Reference a Text File with relative path in Java with the IntelliJ IDEA

java,text,relative-path
I have a program that reads numbers from a .txt file. My problem is where to place this file, or how to reference it with a relative path to make this file accessible without using the absolute path.

How to use a relative path instead of an absolute path in processing?

java,path,processing,relative-path,absolute-path
I am fairly new to processing (and programming in general). In a project that I'm doing I need to access the following path: f = new File("C:/Users/Matthew/ColourFeature/data/image1.jpg"); This, being an absolute path, works without any problem. However since this program will be run on different machines I am trying to...

finding file in root of wpf application

c#,xml,wpf,visual-studio,relative-path
I'm trying to load a file with pack://application: The file is situated in the root of my project but I keep getting a null reference error. However When I do an absolute reference it finds the file and loads just fine. What am I missing here? This doesn't work var...

How to use a variable in PHP file from another PHP file with include or require?

php,relative-path,web-development-server
Check out my directory http://imgur.com/SKuXjm9 , its simple. I wanted to call a variable from nuclear_test2.php by nuclear_test.php //I have unsuccessfully tried the following calls as stated below: //include_once("../test/nuclear_test2.php"); //include_once("nuclear_test2.php"); //include_once("./test/nuclear_test2.php"); //require_once("./nuclear_test2.php"); nuclear_test.php <?php require "nuclear_test2.php"; function acheckReturner() { echo " ?" . $check; } acheckReturner(); ?> nuclear_test2.php <?php $check...

Cannot find file path

c#,path,windows-ce,c#-2.0,relative-path
I'm using Windows CE 6.0. I'm developping an application that needs to read a XML file (bar.xml) that is placed right next to my executable (foo.exe). I try to access it with the following method, called right after my Main() : private void ParseXmlFile(string _sFileName) { XmlDocument l_doc = new...

Background-image not dispalys in xsl fo with Relative Path URL

image,pdf,xslt,relative-path,xsl-fo
I am trying to create a pdf using xsl-fo where the background image is being used. I have set up the relative path as follows:- background-image = "url('../themes/images/logo.gif')" When I give absolute path like background-image="C://Images/logo.gif", it worked. but when I use url to take it relatively in the server, it...

IIS Authorization and Restrictions

asp.net,iis,authorization,relative-path,restriction
I'm trying to restrict anonymous users from browsing directly to a particular filename (image file) in a folder on my website. But when I turn on the "IIS Authentication" feature on the folder, both anonymous users and the website application can't access the image file. How can I deny access...

Adding CSS using function in PHP

php,css,relative-path
I was try to add CSS file to my html file using statistic function like this: public static function addCSS($file){ $cssPath = $_SERVER['DOCUMENT_ROOT']. DIRECTORY_SEPARATOR. 'new'. DIRECTORY_SEPARATOR. 'css/'.$file; return file_exists($cssPath) ? " <link rel=\"stylesheet\" href=\"$cssPath\" type=\"text/css\" media=\"screen\" charset=\"utf-8\" /> " : "CSS File not found"; } but it doesn't work as...

Iterate over all files in directory from a specified relative path

java,relative-path
I want to use this kind of "relative" path, because I want to be able to include all the files in this directory as part of a github project that others can download and just run. So I want to just jump up once in the structure ../ and then...

How does the root of a Go web application get resolved?

web,go,relative-path,static-files
Im using go's net/http library to serve up a web app. When users come to the site, they can simply go to /, and it serves index.html (like any site). This is implemented using: r.PathPrefix("/").Handler(http.FileServer(http.Dir("./"))) However, there are two ways to structure such an app. First you could pack all...

Photos doesn't display on iis when using

asp.net,image,iis,relative-path
I've a problem when I try to display a photo using the asp:image tag. I work on Visual Studio 2008, it displays the photo in VS but not on the IIS. If I put my path in the network, it works. I try with absolute, relative and virtual path. Of...

How to find relative path given two absolute paths?

c,path,relative-path,absolute-path
Given two absolute paths, e.g. /a/path/to/a /a/path/to/somewhere/else How can I get a relative path from one to the other, ../a? In a sense, the opposite of what realpath does....

Relative URL for RouteProvider in AngularJS

angularjs,relative-path,angularjs-routing
I have a website that will likely be placed within a directory in IIS. When I am running the application on my computer through IISExpress, the routes are relative to the base URL, so I can just define my routes as follows: $routeProvider.when("/home", { controller: "homeController", templateUrl: "/app/layout/myView.html" }); This...

Having trouble with includes and relative paths

php,include,relative-path
I'm building out a very small page that will live for the duration of a 5 day conference. Each day the site needs to load new content so I'm using a small script to load in an include file. I'm trying to get my includes to be relative paths but...

grunt-contrib-cssmin : Relative path of images is not replaced in target minified file

css,gruntjs,relative-path,grunt-contrib-cssmin
I am using grunt-contrib-cssmin, for the minification of my css files. I want the relative urls in the css files to be replaced automatically in my target minified file. I have looked for this problem and found the two options that I can use to replace the url, target, root...

user.dir is incorrect while using tomcat web app in eclipse

java,eclipse,tomcat,path,relative-path
I have a configuration project that few projects are using it. All of my project under the same workingspace. workingspace/configuration workingspace/webapp1 workingspace/mongoDB workingspace/model mongoDB and the model project are using the configuration jar project and able to read the xml files using relative path ../configuration/conf/....xml when using the System.out.println("Working Directory...

Get Relative paths of all the folders, sub-folders and files in a folder

powershell,relative-path
I have a folder named source. It's structure is like the following. source\a.jpg source\b.jpg source\c.xml source\d.ps1 source\subdir1\a.xml source\subdir2\b.png source\subdir3\subsubdir1\nothing.img I want to list all the relative paths of folders, sub-folders and files in a text file say, out.txt. For above the output I expect is: source\a.jpg source\b.jpg source\c.xml source\d.ps1 source\subdir1\a.xml...

How to get relative path of a file in a different library?

visual-studio,relative-path
I have two projects in my solution: Echipieri.Data (database repository) -> Locations.txt Echipieri.Web (ASP.NET MVC) I want to read the locations file from Data but I can't figure out the relative path. I tryed: string path = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Locations.txt"); But it searches in Echipieri.Web not Echipieri.Data. How do I get...

How can I get paths relative to the current directory from git status?

git,path,relative-path,git-status
I wish to use the output from git status in a script but, because the output is always giving repo-relative file paths, other commands can't find their args. This question mentioned the relativePaths option but it has no effect on output when given as a command option: git -c status.relativePaths=true...

C++: Write content to file using relative path

c++,file,relative-path
I am writing C++ programs and code is organized as below main.cpp source/newfile.cpp header/newfile.h files/file.txt main.cpp calls newfile.cpp. From newfile.cpp I want to navigate to files/file.txt and write some content there. My code looked like this.. #include <iostream> #include <fstream> using namespace std; class abc { void function () {...

Mac OS - Can I generate a clickable link to local file using relative path like “file:///~”

osx,hyperlink,applescript,relative-path,finder
This is the background: in my company, we use Google Drive and often have to tell each other the path to a particular file. Paths are long as we use a lot of nested folders, so it's pretty boring and time consuming to browse through all that. Now, in my...

Computation of relative path

javascript,relative-path
I am facing difficulty in understanding relative path concept, I have seen a part of code written as ../../abc/file/images/picutre/down.gif how the relative path is computed...

Wrong file path used while running web application

java,spring,relative-path,spring-tool-suite
I am developing a Spring application using the Spring tool suite. My basic aim to read an existing xml file and do some stuff with it. The problem I am facing is that I am not able to use relative file path while running my code on server (tomcat 8.0.18)....

Issues with relative/absolute path

php,path,relative-path,realpath,pathinfo
I've searched ways to do it so it would work but none of them seemed to work for all paths, so I was wondering if you could give me a direction on how to do this: This is the structure: Home Directoy config.php index.php includes/ user_login.php applicant_track.php ucp/ index.php When...