filepath

Regular expression for file path which doesn't allow parent directories

I'm looking to write a regex for a file path that must start with some prefix. In this case it should start with '/tank/home/'. I also want to make sure that it contains no '/..' -- no jumping up to parent directories. I spent a while fiddling around without coming up with anything quite right. I settled on using two regexes, the first ...

How can one get a canonical file path in .NET?

Dear ladies and sirs. How can one with minimal effort (using some already existing facility, if possible) to convert paths like c:\aaa\bbb\..\ccc to c:\aaa\ccc ? ...

AS3 - playing video within a loaded swf

My file structure is this: main.swf /swf/child.swf /video/testvideo.flv When I compile the child.swf by itself, it loads and plays video just fine (using netStream.play(../video/testvideo.flv). However, when I compile the main.swf, which at some point loads child.swf, I get this error when trying to play the video: Error #2044: Unhand...

How to get the current startup project's physical location in VB.NET or C#?

I want the location of the current execution project i.e in VB.NET/C# or the current class file's path? Ok,let me elaborate i got 2 projects in one solution file,lets say A,B are projects, my startup project is B ,and im accessing a class file in A ,now i need to know virtual path of B. because i need it for accessing the resource file ...

How to determine if 2 paths reference the same file in portable C++

Hello. I was wondering if there is a portable way to determine if 2 different paths actually reference the same file. I have read this thread but is Windows-specific. AFAIK, fstream isn't suitable for the job. ...

Visual Studio - Unit tests loading resources in the project

Consider a VS Test project looking like this: The goal is to run some tests given some data in those Xml files. How would you easily load a given Xml file into an XmlDoc within the unit test methods? Current state is: XmlDocument doc = new XmlDocument(); string xmlFile = "4.xml"; string dir = System.IO.Directory.GetCurrentDir...

Using Named Pipes as Files

Simple question here (though perhaps not such a simple answer): Is it possible to specify a path for an (existing) named pipe that can be used by programs as if they were opening on a normal file? According to this MSDN page, name pipes on the local computer can be referrenced using the following path syntax: \\.\pipe\PipeName, yet I'm...

How does filepaths in php work?

Hi. The problem is that I use the method file _ get _ contents("body.html") in a class that is in the same folder as body.html. The problem is that I get an error saying that the file could not be found. This is because I from another class require the file that uses the method file _ get _ contents("body.html"), and suddenly I have to...

Split File Path into Components in iPhone SDK

Is there a framework or a library that I could use to split a file path into its components in iPhone SDK? I know I could code it myself, but I don't want to reinvent the wheel. ...

How do I use a variable in a UNC path in powershell?

Hi All, and thanks in advacne for your help large or small. A bit of a newbie to the powershell world and I'm trying to count the contents of a folder on a remote server. I know that: Get-ChildItem \\ServerName\c$\foldername -recurse | Measure-Object -property length -sum works a treat. However I'm trying to make the server name a...

How to append '\\?\' to the front of a file path in Python

I'm trying to work with some long file paths (Windows) in Python and have come across some problems. After reading the question here, it looks as though I need to append '\\?\' to the front of my long file paths in order to use them with os.stat(filepath). The problem I'm having is that I can't create a string in Python that ends in a ...

MSBuild ITaskItem RecursiveDir metadata disappears

I have a custom MSBuild task, which processes a set of files and returns a modified subset of this. Basically, I just create a new ITaskItem array out of the input, skipping some items. However, the RecursiveDir metadata disappears when this result set is returned to MSBuild! It is still with the correct values at the end of my custom t...

how to check a file path is an image or not in php?

Hi guys, I have a table that stores file paths of images.documents,pdf etc... My query is Select File_Paths from Uploads Now how do I check whether the file path is image or not using PHP... If it is an image i have to view it or else download it....... ...

Security problem with custom search provider for Windows 7

I built a search provider for Windows 7. (using .osdx file and RSS web site) the element in the returned RSS contains local file path. example: <link>c:\windows\win.ini</link> The problem is that the files shown in the search result window with the following message: This item was blocked because of your Internet security settings...

Path separator for Windows and Unix

Is there any special character that cannot be a part of the path in Windows or Unix that I can use it as a separator? ...

XAMPP file path slashes error

I tried using XAMPP on vista and gave up...I faced an issue with backslashes(widows uses forward slashes)..due to this none of my scripts could save any files to folders because the path would be like dir1\dir2\folder/image_folder/image.jpg...I tried WAMP it worked like a charm..it threw no errors and saved the image files as intented..I...

PHP: include file relative to calling file NOT root file?

OK say I have a file called fileA.php in the same directory I have another file called fileB.php so inside fileA there is this require_once('fileB.php') notice I did not specify a file path because both files are in the same directory. Now if fileA is included into another file that is located somewhere else, it fails to include fileB ...

What is best way to convert a file URL to a BOOST filesystem path in C++?

Hello I'm writing a library that has filenames as inputs. One feature that I'm trying to include is to allow the user to pass in file URLs or file paths, because sometimes the input is generated from parsing XML, other time it's not. I'm using the boost filesystem to manipulate the path, and is wondering what is the best way to conver...

Playing a .wav sound file in JPanel/JFrame using Java (Swing)

I need some code example on how I would use a filepath from a harddrive location to then play a .wav sound file when opened in swing GUI. I don't need it to show a play button, or pause or stop. I just want it to play when I select the 'Sound' option from my 'Files' in my window (I know how to do that already, no need to explain that). ...

Using file-path to images stored within the Application Settings

I am trying to develop an application that uses a number of images that are stored in a seperate remote file location. The file-paths to the UI elements are stored within the Application Settings. Although I understand how to access and use the file-path from Settings in C# (Properties.Settings.Default.pathToGridImages + "OK.png"), I am...