Is it possible to choose to serve files only from a specific folder using Rikulo stream? I've tried
new StreamServer(uriMapping: _mapping, homeDir: 'my/web/webapp/app')
but I'm not getting the desired results as it's still serving files under the 'web' directory.
When homeDir is specified with a relative path, it is assumed to be relative to the current directory (Directory.current.path). I think it is not what you expect. You can use an absolute path for better control.
After examining the code, I think the relative path is better to base on the root directory rather than the current directory. Please follow Issue 29 for details. Also refer to the sample app here.
Related
What is the difference between these two pathnames? Is / necessary to put in start for going in a folder?
assets/myImg.png
/assets/myImg.png
/assets/myImg.png is an absolute path. It means no matter where do you call the path from it's always the same. assets/myImg.png is relative path to your current directory
You haven't mentioned an OS, so given the leading / I'll assume we're on a Unix-like system.
/assets/myImg.png
This is an absolute path. It's going to look in the root directory of your file system for a folder called assets and go from there.
assets/myImg.png
This is a relative path. It's going to look in the current working directory, which is likely the directory where you started your current program. If you're using this from the command line, it's going to look starting from the current directory of the shell (i.e. the thing you change with cd).
Using ASP.Net MVC - AdoDB
Im used to upload and download from inside the webserver where I published my files
Server.MapPath("~/UploadedFiles/pdfDocuments/");
and it worked fine.
But now, I want to send them to another root outside the webserver, inside a network directory(shared folder). Need your help because I already tried this:
Server.MapPath(#"\\sharedfolder\UploadedFiles\pdfDocuments\");
Please help me on this. Ill appreciate.
I think you no longer need Server.MapPath at all. Its purpose is to map a relative / virtual path (e.g. an incomplete path such as ~/UploadedFiles/pdfDocuments/ into a full path to a file on disk, e.g. that string might get converted into C:\inetpub\wwwwroot\UploadedFiles\pdfDocuments, for example.
Since you are now using a UNC path (i.e. a path in the form \\server\share), this is already a fully qualified path to a resource. There is no missing information. Therefore in this situation MapPath has no purpose. You can simply remove the line which uses MapPath from your code, and pass your UNC path directly to your upload/download code.
Server.MapPath only works on relative and virtual paths. https://msdn.microsoft.com/en-us/library/ms524632(v=vs.90).aspx
If that is a valid path from you server us it directly.
I know the subject line must sound really stupid. Of course you would locally develop HTML files - didn't know how to phrase it better since I'm a beginner at HTML+CSS.
So to get to the point:
I'm linking to images and pages on the HTML file I'm editing. However, when I open the HTML file in my browser locally the links are broken because I'm not using an absolute path. My preference is to use relative path because I'll be able to simply move my project file folder onto my server without having to change the URL paths in my HTML files.
My question is: How do I get the relative paths to point to where I want without having to list the entire drive directory?
Ex. My local HTML has the following line:
<img src="/images/logo.jpg">
But opening the local HTML file in my browser, the image is broken since it points to: file:///D:/images/logo.jpg
How do I get it to point to {local root}/images/logo.jpg instead?
What I did was to install a local development server such as EasyPHP, and setting the proper root folder within my project folder. Setting the root folder tells the local server where the root is, and so any relative paths work as expected.
I have one exe say myApp.exe in C:\MyProject folder. It writes logs in logfile say tracefile.log which is also there in C:\MyProject.
Now I have to make a schedule task say Schedule1.exe which will also write in logfile tracefile.log located in C:\MyProject.
Ok, I created Schedule1.exe and kept it in same folder C:\MyProject folder and made schedule taks using this exe.
Problem: Schedule1.exe cannot pick the path of logfile when I give relative path of logfile as ".\tracefile.log". But when I give full path like "C:\MyProject", it picks the logfile path and writes on it.
Please suggest what could be the problem?
Relative paths are relative to the working directory of the process. The working directory of the process is determined at process startup, and may not be the directory that contains the executable. What's more, the working directory can change during the processes life.
It seems to me that you should be giving a full path to these files. You need to get hold of the directory in which the executable lives. That is
ExtractFilePath(ParamStr(0));
So you should be using this code to name your file:
ExtractFilePath(ParamStr(0)) + 'tracefile.log'
Is there a simple way to open a file from within a fixture, using a path relative to the current wiki page? The files are actually being stored in the same directory as the wiki page.
I'm using those files to store some expected data, that is later compared to the data actually measured while executing a test. Embedding the data in the wiki page would simply be too much.
I've already spent quite some time searching through the API, but couldn't find anything except how to access files in Fitness' root folder.
It would be simpler to store the files somewhere relative to the FitNesse root and put the relative path on the wiki page
|calculate some results|
|compare to expected at|relativepath|
To create/access pages path relative to the current wiki page use this syntax:
>RelativePage
> makes path relative from current page.