relative-path

require_once in php

I have a php file which has a require_once Statement (?) this file is then in included in 2 other php files, one php file is in a sub directory so the layout is like this ("file1" and "file2" include the file "included" which require_onces the "required")# L--subfolder1 | L--file1 L--subfolder2 | L--required L--file2 L--included...

Get license file from a folder in C# project

I have a license file that I need to access at runtime in order to create pdf-files. After I have created the in memory pdf, I need to call a method on that pdf to set the license, like this: pdf.SetLicense("pathToLicenseFileHere"); The license file is located in the same project as the.cs-file that creates the pdf, but is in a separa...

Java EE: How to resolve this simple problem about relative path?

I'm trying to integrate Struts2 with JasperReports (don't run away - this is not the problem :) ) I have a jrxml file which needs to be put in WEBAPP_FOLDER/jasper. In my action i need to create a jasper file based on the jrxml file from that location: JasperCompileManager.compileReportToFile( "jasper/our_jasper_te...

Getting the relative path to the rdlc report in my winform app.

I am automatically creating a PDF from some of our reports in a month-end process. I am running into a problem where ReportViewer.LocalReport can't find my report. Within the project, the report files are in "(project root folder)/Reports/report.rdlc". How do I set ReportViewer.LocalReport.ReportPath so I can reference my report file? I ...

Relative Path issue with .Net Windows Service..?

I have a windows service which is trying to access an xml file from the Application directory. Windows Service Installed directory : C:\Services\MyService\MyService.exe Path of the xml file : C:\Services\MyService\MyService.xml I am trying to access the file using the following code. using (FileStream stream = new FileStream("MyServi...

Relative to absolute paths in HTML (asp.net)

Hello all, I need to create a newsletters by URL. I to do next: Create a WebClient; Use WebClient's method DownloadData to get a source of page in byte array; Get string from source-html byte array and set it to the newsletter content. But I have some troubles with paths. All elements' sources were relative (/img/welcome.png) but I...

How to execute programs in the same directory as the windows batch file?

I have in the same folder a .bat and a .exe file. I couldn't call the .exe file from the .bat unless I put the full absolute path to it. Is there a way to don't specify the path? ...

Is there an easy method to combine two relative paths in C# ?

I want to combine two relative paths in C#. For example: string path1 = "/System/Configuration/Panels/Alpha"; string path2 = "Panels/Alpha/Data"; I want to return string result = "/System/Configuration/Panels/Alpha/Data"; I can implement this by splitting the second array and compare it in a for loop but I was wondering if there i...

PHP: Extract direct sub directory from path string

I need to extract the name of the direct sub directory from a full path string. For example, say we have: $str = "dir1/dir2/dir3/dir4/filename.ext"; $dir = "dir1/dir2"; Then the name of the sub-directory in the $str path relative to $dir would be "dir3". Note that $dir never has '/' at the ends. So the function should be: $subdir ...

Mapping Absolute / Relative (Local) Paths to Absolute URLs

I need a fast and reliable way to map an absolute or relative local path (say ./images/Mafalda.jpg) to it's corresponding absolute URL, so far I've managed to come up with this: function Path($path) { if (file_exists($path) === true) { return rtrim(str_replace('\\', '/', realpath($path)), '/') . (is_dir($path) ? '/' : ''...

Compose path (with boost::filesystem)

I have a file that describes input data, which is split into several other files. In my descriptor file, I first give the path A that tells where all the other files are found. The originator may set either a relative (to location of the descriptor file) or absolute path. When my program is called, the user gives the name of the descri...

ASP.NET MVC 2 relative paths for scripts and styles

Hi, having this really silly problem in ASP.NET MVC 2 with .NET 4. I need to test other pages using localhost, but sometimes I need to show the page to some else on another computer and so need to path out to my machine. In doing so, I need to use relative paths for my and tags. When I test through VS, I use relative path: <script sr...

NAnt and relative path execution

How can I assign to trunk.dir property a relative path to the trunk location? This is my nant.build file: <?xml version="1.0" encoding="utf-8"?> <project name="ProjectName" default="build" xmlns="http://nant.sf.net/release/0.85/nant.xsd"&gt; <!-- Directories --> <property name="trunk.dir" value="C:\Projects\ProjectName" /><!--...

Could I do this blind relative to absolute path conversion (for perforce depot paths) better?

I need to "blindly" (i.e. without access to the filesystem, in this case the source control server) convert some relative paths to absolute paths. So I'm playing with dotdots and indices. For those that are curious I have a log file produced by someone else's tool that sometimes outputs relative paths, and for performance reasons I don't...

How do I link to an item in the public folder from views/controller_name/page1.html.erb in Ruby on Rails?

I need to embed a flash movie into one of the pages in my Ruby on Rails app. I've put the Flash movie into the public folder, but I'm not sure how to reference it from my page, which is located at views/controller_name/page1.html.erb. How do I do this? Thanks for reading. ...

Mvc relative path using virtual directory..help!

When i drag and drop my image/script/css file into my view, relative path will automatically use to refer on the files. example: <link href="../../Content/style.css" rel="stylesheet" type="text/css" /> <script src="../../Scripts/jquery-min.js" type="text/javascript"></script> <img src="../../Images/logo.jpg" /> It is working fine ...

php nested include behavior

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 "../ano...

Properly setting up path variables for root.php

Hi guys, I just posted a similar question, but deleted it because I realized I was working with an old file...doh! I am just trying to get my XAMPP setup working for me. I have a live site that navigates to a login page at http://www.monkeycalendar.com/arvindkt/login.php That login page includes a root.php file that is found at http...

HTML relative links on various domains

I have quickie: When you code/develop themes, how do you link to various files in your html/css code? Example: We at our firm use mostly <base target="http://whatever"&gt; in our main template and then just <img src="./images/file.png"> in our html, "/category/page" as links and something alike in our css. However, when testing on dif...

Regex to replace relative link with root relative link

I have a string of text that contains html with all different types of links (relative, absolute, root-relative). I need a regex that can be executed by PHP's preg_replace to replace all relative links with root-relative links, without touching any of the other links. I have the root path already. Replaced links: <tag ... href="path/to...