add server.setVDocRoot api function #147
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
Implements a virtual document root for local folders. When building an application to access local files, system functions can be used to read and display file content. However, if a file (such as an HTML document) references other local files (e.g., images in the same folder), these references typically fail to resolve (see #1291).
Changes proposed
Adds a
setVDocRoot
function to designate a local folder as the virtual document root for resources.How to test it
Before opening a local HTML file containing referenced images, use
setVDocRoot
to set the virtual document root to the folder containing the HTML file and images. Verify that the images are displayed correctly.Deploy notes
This change introduces a new function,
setVDocRoot
, which may require adjustments to existing build processes or deployment scripts if they rely on specific file paths. Ensure that the correct path is passed to setVDocRoot during application initialization. Consider adding documentation or examples demonstrating its usage.You need update your neutralino.js too
Usage