I have developed npapi plugin using firebreath. I want to access one image that is placed inside the computer. I am confused how to give the file path in plugin class or shall i need to place it in other specified folder?? Please help.
Inside your main plugin object you can call getFSPath() to get the full path and filename of your plugin .dll. You can use that to then find a relative path to a resource file you want to open.
In 1.7 or later (1.7 was released on Dec 17, 2012) you can #include "BrowserPlugin.h" and use BrowserPlugin::getFSPath() from anywhere. From there it's just a simple string manipulation, or if you want to be a little more complete / foolproof you could just use boost::filesystem
#include <BrowserPlugin.h>
#include <boost/filesystem.hpp>
using namespace boost::filesystem;
// ....
std::string getPluginDirPath() {
path pluginPath(BrowserPlugin::getFSPath());
return pluginPath.parent_path().string();
}
Related
I'm trying to include Eigen in UE5 - there's some old UE4 documentation on this but it produces a different plugin file.
It looks like UE5 includes Eigen under Engine/Source/ThirdParty/Eigen/, but the actual library does not seem to be there. So, I tried to add a new plugin using the UE5 editor (called 'ThirdParty'), include the Eigen source manually under Plugins/ThirdParty/Source/Eigen/, and add the path references i.e.:
PublicIncludePaths.AddRange(
new string[] {
"Eigen",
}
);
However, this does not seem to work, as #include 'Eigen/Dense' or just 'Eigen' results in an error in the rest of my project. Any ideas? Many thanks.
In Unreal Engine 5 all you should need to do is add
AddEngineThirdPartyPrivateStaticDependencies(Target, "Eigen");
into your project or plugins Build.cs file, and you should be able to include the library using
#include <Eigen/Core>
as usual!
I'm using doxygen for my C++ project documentation. The project's version related API is version.hpp, generated from version.hpp.in via cmake's configure_file commands. Thus, version.hpp is located in #CMAKE_BINARY_DIR instead of CMAKE_SOURCE_DIR.
Here comes the question: I documented version.hpp.in, generated doxygen page from version.hpp, but I would like to mark the APIs' including path as ${CMAKE_SOURCE_DIR} (a relative path), instead of ${CMAKE_BINARY_DIR} ( a full path). How can I do that?
The resolution is, mark the redundant directory prefix in Doxyfile.in
STRIP_FROM_PATH = #CMAKE_BINARY_DIR#/include
Reference:
How do i remove the source path in doxygen
I want to read the absolute path of the preference file for a particular plugin which is generally stored at:
Platform.getLocation() + "\.metadata\.plugins\org.eclipse.core.runtime\.settings\myPlugin.prefs"
Is there any way to get it directly somehow using eclipse provided Apis instead of hard-coding the 2nd part of the path?
This should give the correct location:
Bundle rt = Platform.getBundle(IPreferencesConstants.RUNTIME_NAME);
IPath path = Platform.getStateLocation(rt).append(".settings").append("myPlugin").addFileExtension("prefs");
The actual location calculation is in org.eclipse.core.internal.preferences.EclipsePreferences
I've been trying to make a library in Dart and import it in my project. Though for some reason it won't do it.
Here's how it looks:
It says it can't find the library, though the path is correct. I also tried a bunch of other paths:
SmartCanvas.dart
SmartCanvas/SmartCanvas.dart
SmartCanvas
SmartCanvas/SmartCanvas
./SmartCanvas/SmartCanvas.dart
../SmartCanvas/SmartCanvas.dart
./SmartCanvas.dart
../SmartCanvas.dart
./SmartCanvas
../SmartCanvas
Note: The project I'm trying to import this library into is located somewhere totally different on my harddrave (my dropbox folder.)
Anyone knows what I should use as path, or how I can import the library properly?
Thanks!
#import expects a full path or correct relative path to a .dart file that has the #library line.
Here is an example from working code:
https://github.com/johnmccutchan/DartVectorMath/blob/master/test/console_test_harness.dart
At the top you see #import('../lib/vector_math_console.dart');
which is located:
https://github.com/johnmccutchan/DartVectorMath/blob/master/lib/vector_math_console.dart
Chopping off the github url prefix, we are left with:
test/console_test_harness.dart
lib/vector_math_console.dart
The import line uses the correct relative path from test/ into ../lib/ to find vector_math_console.dart (the library).
HTH,
John
Try this for windows
#import('/c:/users/pablo/pablo\'s documents/projects/smartcanvas/smartcanvas.dart');
To import local libraries in dart, I'd recommend using the the path dependency in the pubspec.yaml. This is a much cleaner approach then embedding absolute paths in the dart code.
Read about it here: https://www.dartlang.org/tools/pub/dependencies.html#path-packages
I have a project with a image stored as a logo that I wish to use.
URL logoPath = new MainApplication().getClass().getClassLoader().getResource("img/logo.jpg");
Using that method I get the URL for the file and convert it to string. I then have to substring that by 5 to get rid of this output "file:/C:/Users/Stephen/git/ILLA/PoC/bin/img/logo.jpg"
However when I export this as a jar and run it I run into trouble. The URL now reads /ILLA.jar!/ and my image is just blank. I have a gut feeling that it's tripping me up so how do I fix this?
Cheers
You are almost there.
Images in a jar are treated as resources. You need to refer to them using the classpath
Just use getClass().getResource: something like:
getClass().getResource("/images/logo.jpg"));
where "images" is a package inside the jar file, with the path as above
see the leading / in the call - this will help accessing the path correctly (using absolute instead of relative). Just make sure the path is correct
Also see:
How to includes all images in jar file using eclipse
See here: Create a file object from a resource path to an image in a jar file
String imgName = "/resources/images/image.jpg";
InputStream in = getClass().getResourceAsStream(imgName);
ImageIcon img = new ImageIcon(ImageIO.read(in));
Note it looks like you need to use a stream for a resource inside an archive.