The folder structure is:
HOME\htmlhelp\wwhelp\wwhimpl\js\scripts
HOME\auxi\
I can read a csv file (located in the HOME\htmlhelp dir) from a js file located in the HOME\htmlhelp\wwhelp\wwhimpl\js\scripts dir using the following:
var file_path="../../../../../htmlhelp/rule_mapping.csv";
However, the same js file (from the same location) cannot read the same csv file in the HOME\auxi\ directory!
Am using the path as var file_path="../../../../../auxi/rule_mapping.csv";
It throws an "NS_ERROR_DOM_BAD_URI: Access to restricted URI denied" error. I have checked the file permissions and stuff but no luck.
Any help would be appreciated.
The problem lies within:
var file_path="../../../../../htmlhelp/rule_mapping.csv";
It's not possible to traverse up to paths out of the root directory where the document is located.
Assuming you work under UNIX (Linux/Mac), one solution would be to create a symbolic link on the root directory of the document, such as (executing from the scripts directory):
ln -s ../../../../../htmlhelp/rule_mapping.csv rule_mapping.csv
And changing the file_path to:
var file_path="./rule_mapping.csv";
I hope this helps!
Related
I have the next web site folder structure (in short):
Root_folder
PHP_folder
index.php
Javascript_folder
app.js
Assets_folder
my_texture.jpg
..."index.php" calls "app.js" with the line:
<?php include '../Javascript_folder/app.js'; ?>
...and "app.js" calls "my_texture.jpg" with the line:
var texture = new THREE.TextureLoader().load("../Assets_folder/my_texture.jpg");
... but "my_texture.jpg" is not found.
If I put "my_texture.jpg" in the same folder of "index.php" and change the javascript path to:
var texture = new THREE.TextureLoader().load("./my_texture.jpg");
... the bitmap is found, but obviously I prefer to keep the assets in their own folder.
How could I find the bitmap respecting my current folder structure?
0K
I resolved this issue opening the Ubuntu terminal (bash/Ubuntu) within the root folder of my site:
Root_folder$ php -S localhost:4000/PHP_folder/index.php
My local server cant find the sub-folder "Assets_folder" files when I execute the server within the sub-folder "Assets_folder/PHP_folder/" with this order:
Root_folder/PHP_folder$ php -S localhost:4000/index.php
In short, using bash terminal/php local server must be initied from the root folder of the site.
Also, I want to warning that some remote servers (like the one that Im paying) doesn't have the .htaccess file.
I have to create and write the .htaccess:
DirectoryIndex PHP_folder/index.php
I am a Spanish speaking self-taught programmer and I hope I did not use incorrect terms
How to write a file path that will point to a directory.
From what I have googled,
/path means root,
./path means current directory,
../path means parent directory
I am playing with Framer.js + Yeoman.
If you look at the screenshot attached:
myLayers = Framer.Importer.load("../imported/test1") is not working?
When I put the "imported" folder under the "app" folder it is working.
Looks like you need to hope out one more parent directory, to the root test1.framer directory, before you can go into the imported directory. ie:
myLayers= Framer.Importer.load("../../imported/test1")
(starting from main.js file and only going up one parent directory only gets you in the app directory)
First I'd like to say thanks for taking the time to read this.
I am trying to open a JSON file that is in the following directory structure:
#--> Root Folder
--> App.exe
#--> Configuration
---> JSON File
So I used the Code:
var ConfigFile = "./Configuration/JSON.json";
Followed by:
var fs = require('fs');
var file_content = fs.readFileSync(ConfigFile);
var content = JSON.parse(file_content);
// Manipulate the Data
For some odd reason, Node-Webkit seems to be looking for the folder in a Temp Directory located in:
C:\Users\User\AppData\Local\Temp\nw9740_14956\Configuration
The file is not there, and thus in the Console I get the following Error:
Uncaught Error: ENOENT: no such file or directory, open
'C:\Users\User\AppData\Local\Temp\nw9740_14956\Configuration\JSON.json'
I am running Windows (as you can tell), and I would like for fs to pull the file from the Folder (Configuration) that is adjacent to the app.exe.
Any help is appreciated
I've only done this once, so I may be wrong, but it looks like you're bundling your app content into the exe? If you do this, node-webkit will extract the app contents into the %TEMP% folder and then run the content from there.
Try checking the command line arguments to see if arg[0] will point you to the actual node-webkit exe that's running the app. From there, you should be able to construct a path to your configuration data.
I have one .js file named final.js which I copied as bundle resource I have a requirement like the html document which reads this js file should download at runtime and store it in documents directory. But the js file is not able to read by the html when I loaded it in webview, because of the path of .js file.
I tried with the solution like below, but not worked.
<script src ="./final.js"> </script>
And finally I tried to copy the hardcoded path of application bundle like below, now it worked. Finally I come to know that the path is not proper.
> <script src ="/Users/unknownUser/Library/Application Support/iPhone
> Simulator/7.0/Applications/025EF3B6-F2E6-4162-8921-839D7D98FF58/HTMLGetdataTestApp.app/final.js">
> </script>`
Can any one tell me that how a html file which is stored in documents directory can read a .js file which is stored in main bundle with the correct path instead of hardcoded like above.
The simple solution will be copying the final.js file to documents directory.
Copy the js file from bundle to the document directory (where the html page is located) and set the path as:
<script src ="final.js"> </script>
How can I set the root folder in JavaScript when using Ajax?
This is my code?
var url="../../ajax_permission_data.php"
url=url+"?opp="+operation+"&userid="+userId;
url=url+"&sid="+Math.random()
But I am getting error file not found. If I am putting this file in same folder then it will work. But I don't want to all the files in same folder. So please help me how to set the path.
var path="http://www.mysite.com/";
var url=path+"folder/ajax_permission_data.php";
url=url+"?opp="+operation+"&userid="+userId;
url=url+"&sid="+Math.random();