I was using the basePath property but the result of the build is not what I expected.
This is my profile based on one of the basic examples
dependencies= {
basePath:"../..",
releaseDir: "./TESTING"
};
I’m executing the build with the following command (shows the folder where the batch file is located and the full path to the profile)
C:\Users\me\Downloads\dojo-release-1.10.8-src\util\buildscripts>build.bat --profile "C:\Users\me\Downloads\dojo-release-1.10.8-src\util\buildscripts\profiles\test.profile.js" --release
According to the documentation
https://dojotoolkit.org/reference-guide/1.10/build/buildSystem.html#id1
“If the profile contains the property basePath and the value of that
property is a relative path, then the build system will automatically
resolve that path with respect to the directory in which the profile
resources resides–not the current working directory”
“Relative destination paths are computed with respect to the profile
property releaseDir, optionally with a concatenated path segment given
by profile property releaseName. If releaseDir is relative, then it is
taken to be relative to basePath”
So if I specify the basePath as I did, I would have expected it to place itself relative to the profile location that I specified, so that is
Profile location
C:\Users\me\Downloads\dojo-release-1.10.8-src\util\buildscripts\profiles\test.profile.js
basePath location relative to profile (go back two levels)
C:\Users\me\Downloads\dojo-release-1.10.8-src\util\
So going back two levels means placing myself in the ‘util’ folder
So I would expect the release dir to be written in the util folder as well.
However it is being written to the
buildscripts folder inside util.
On a second test I made the profile like this
dependencies= {
basePath:"../..",
releaseDir: "../TESTING"
};
And my release directory was written to the util folder. Which means the basePath I specified is actually pointing to the buildscripts folder but there is no subfolder deep enough to get to it using …/… if …/… means going back two levels.
So either I misunderstand what …/… means or something else is going on.
Can someone please explain how paths work in the build system when you specify a basePath?
Thanks
Related
In a UWP app using cppwinrt I want to use WebView to display contents of a book kept in the Assets folder. I read that it is necessary to reference an html asset this way for use as a Uri argument to the Navigate method in web view:
TheWebView.Navigate(Uri(L"ms-appx-web:///SampleBook/PageOne.html"));
This produces an empty view, while
TheWebView.Navigate(Uri(L"ms-appx:///SampleBook/PageOne.html"));
crashes. Msdn says that for files "that will be loaded into the web compartment" one must use ms-appx-web, and I've seen mention that this is a security issue. But does that mean the files are in a special location within the project - i.e. not merely in the Assets folder - or does it only mean that the path must begin with ms-appx-web independent of the file's location? "Web compartment" is not explained but seems to be not a location but rather a classification of the type of resource. At any rate, neither of the above approaches works, so I'm curious to know the recommended way to store and access a collection of html files in the package. In the assets folder? A special folder within assets? In Solution Explorer the html file is listed, "content" is True, and the file is Included In Project. Thanks.
My mistake: ms-appx-web does not point to the assets folder, but to its parent. The correct path for content of this type would be ms-appx-web///Assets/SampleBook/PageOne.html. The reference to material to be "loaded to the web compartment" apparently is just a way of saying: stuff to be loaded with WebViewer.
I'm building an app with react-native, and I'm trying to use the react-native-fs module to list out a series of images located in the app folder. The images are located in a folder in the app project folder named 'data', so for example if I want to display one of the images, this works:
<Image source={require('./data/boo.png')} />
However when I try to use react-native-fs to list out all the files in that folder like so:
RNFS.readdir(RNFS.DocumentDirectoryPath+'/data')
.then((result) => {
console.log('GOT RESULT', result);
})
.catch((err) => {
console.log(err.message, err.code);
});
I get the error 'Folder does not exist'. Also when I remove the +'/data' the only result listed is a file by the name of 'ReactNativeDevBundle.js', with a path of '/data/user/0/com.awesomeproject/files/ReactNativeDevBundle.js'. Is this the expected behavior? If this is the expected behavior, and I am doing something wrong, how can I access the file folder I want from within the app? Side question, if I wanted to provide that Image tag with an absolute path, what would that look like.
First, are you creating the data folder in running time? or why do you think that's where the files are?
Second,
Also when I remove the +'/data' the only result listed is a file by
the name of 'ReactNativeDevBundle.js', with a path of
'/data/user/0/com.awesomeproject/files/ReactNativeDevBundle.js'. Is
this the expected behavior?
Yes, this is the expected behavior, RNFS.DocumentDirectoryPath goes directly to /data/user/0/com.awesomeproject/files/, this is where you should create the data folder if you want to keep using the same code you currently have
EDIT:
According to one of the contributors of the package: if your folder is within the javascript-space this package won't work.
If you're using android, you may need to put the files into the assets-folder within the android-folder. Then you should be able to use readDirAssets.
I recommend to read Differences between File Source
Excerpt:
Normal Files: These files are created by your app using fs, or fetch API, you can do any operation on these files.
Asset Files: Compiled into the app bundle so generally they're on
readonly mode
I'm trying to change the eglfs mouse cursor graphics for my embedded linux QT application (QT5.5). I have the new cursor atlas PNG and the new JSON descriptor file, but the documentation is rather vague:
".. a custom cursor atlas can be provided by setting the QT_QPA_EGLFS_CURSOR environment variable to the name of a JSON file. The file can also be embedded into the application via Qt's resource system."
I'd prefer to keep everything within the resource system if possible but I can't work out how to do it.. do I need a specific qrc file containing the path to the JSON file? I assume that the PNG file would also need to be added as a resource so that it gets built into the application?
If adding it via the resource system is a bad idea where's the correct place to set the QT_QPA_EGLFS_CURSOR environment variable? I'm currently specifying the platform on the command line via "-platform eglfs"; will this be ok or will I need to set the platform to eglfs in the build?
After much trial, error and digging around I have found the solution that I was looking for within the resource system.
Create a new resource file called "cursor.qrc", the contents of which needs to be two lines:
path/to/your/custom-cursor-atlas.png
cursor.json
The first line (path to your cursor atlas) must be relative to your resource directory.
You then need to put the JSON file (contents as described in the documentation) in the root of your resource directory. It must be called "cursor.json", and its image location line must must match the location in your new resource file and be of the format:
"image": ":/path/to/your/custom-cursor-atlas.png",
This will then include your cursor atlas in resources, and Qt will find it when your application starts.
Run time solution example:
export XDG_RUNTIME_DIR=~
export QT_QPA_EGLFS_CURSOR=~/cursor.json
In the cursor.json:
"image": "cursor.png",
Put your custom cursor.png atlas into your home dir (~) then run the Qt app from there.
I am new to programming, so I am confused. I know that relative path is a way to specify the location of a directory relative to another directory.
But I don't understand why do I need relative path. Could you please give me an example?
why do I need relative path
So that when you ship your code, you don't have to worry about where the user will put that code, while using a path to some resource.
You can use a path relative to the project root, which will be same regardless of where the project is.
Absolute path is the full directory path .
Relative path is relative to the directory you are in, so if you are in the above directory, then if you reference file test.txt as relative, it assumes the same directory you are in. When you do ../ then it goes back one directory.
Suppose you are in a directory whose path is k... In this directory there is a file named a.txt. Now
the absolute path is C:\A\B\a.txt
the relative path is a.txt (as you are in the same directory).
Why you need a relative path
You need a relative path so that in your code you can use any file without depending on the path set by user. For example in your code you need to access a file. If you use absolute path then the path will change depending on the location where the user will set it.
But if you use relative path then the path will be always same as it will always be in your project folder. (or a fixed hiararchy)
Great question. I've noticed relative paths are extremely helpful when dealing with larger sites that have a test or staging area, then the actual live site.
For example, say you have TEST.MYSITE.COM which in turn gets pushed out to WWW.MYSITE.COM. In this example, relative links do not need to be updated because you test the file, the push live when it meets your expectations.
Lets say you have an html file that references TEST.MYSITE.COM/MYFOLDER/MYIMAGE.JPG and you would like to update this image. After the image has been corrected, if you are not using relative links, you would then need to change the image name on the html file from "TEST.MYSITE.COM/MYFOLDER/MYIMAGE.JPG" to "WWW.MYSITE.COM/MYFOLDER/MYIMAGE.JPG".
If one was using the relative link "/MYFOLDER/MYIMAGE.JPG" this would not need to get updated. You could only imagine how this example would get multiplied throughout the site, which would then become a tedious process.
Relative links help avoid this. Hopefully this makes some sense. It sounds like you know what they are, this was just attempting to answer "why do I need relative path[s]".
Few facts first:
1. I can only use ActionScript 2.
2. All files are within the same domain (i.e "http://www.example.com").
I have a loader SWF which acts as a selection tool ("auto_magic.swf") located at "/" in the website (the root folder).
A User selects the tool he needs (it's a mechanical diagnostic system) and the main movie loads it (currently I use loadMovie() - suggest else if needed).
That tool is located at "/tools/[tools_name]/tool_main.swf".
Now, the "tool_main.swf" is loading just fine.
The problem is that "tool_main.swf" needs to load other files located in its folder, so for example it tries to load "config.xml", BUT Flash isn't looking for "config.xml" in the tool's dedicated folder - instead it's looking for this file at the root folder "/" where "auto_magic.swf" is located, probably because the movie's main swf is coming from there.
To make it even worst I cannot modify the tool's SWF ("tool_main.swf") because it's coming from a third party.
Is there any solution? As far as I see this I need one of these solutions;
1. Be able to set the base url of the loaded swf.
2. *Change* the whole movie's base url at run-time because it needs to load several tools from different folders.
Trying to solve this for several good hours. Help will be highly appriciated!
relative paths are always relative to where the main swf exists. so as your load chain expands, '/' always refers to the location of the Main.swf.
in AS2, you can inspect a swfs _url property to determine its fully qualified url location, and determine its parent folder.
In the AS2 child swf, you can use this:
var myfolder = this._url.slice(0, this._url.lastIndexOf('/') + 1);
and then use that to load in further assets relative to itself.
hope that helps.