So my initial problem was that my static resources were placed to appName/static/ and what I wanted to do is to place them to just root directory.
I found this: grails.resources.uri.prefix property and thought that if I change it to '/' it'll all be fine, but now what happens is that it places the resources to appName/// instead.
Is there any way to place them into the app root directory?
Related
I have generate dociql static documentation in my rails application. It has occupied my root route. I need to remove it permanently.
I tried to change the root route and also tried to remove the documentation but it didn't worked.
I've created a folder in the left pane, which holds various images.
It's called "wikiImages".
How do I access this folder or get the path to this folder?
I found Bundle.main.resourcePath!, but this seems to access all assets.
Is there a way to access the path to the folder "wikiImages'?
Assuming wikiImages lives inside your application bundle's resources folder, you can do something like:
if let resourceFolderURL = Bundle.main.resourceURL {
let wikiFolderURL = resourceFolderURL.appendingPathComponent("wikiImages")
}
Like as described in this very related question.
I have an ASP.NET MVC project (SomeProject) with Resources folder in the root folder.
Inside of my resources folder I have such folders and files: PageA\Index.resx and PageB\Index.resx.
After building the project I should have such classes in code: SomeProject.Resources.PageA.Index and SomeProject.Resources.PageB.Index.
However when I try to build, I get such error: Two output file names resolved to the same output path: .....\Index.resources
Is there a way to workaround this problem?
P.S. Please do not offer to rename PageB\Index.resx to something else, as this is not the desired solution.
How do I get application's root directory within an action?
The first thing ZF2 does is to change the current dir via chdir(dirname(__DIR__));
This means that every future include is based off of the ROOT PATH of your application and NOT the public folder. Or any other current folder.
Of course this only holds true for PHP-Files.
If you want to define the root path manually, you'd go to /public/index.php and add a line like define('ROOT_PATH', dirname(__DIR__));
As i said before, for INCLUDES this is NOT required though ;) as you're ALWAYS in the root folder when it comes to PHP-Files ;)
getcwd() works best for me, DIR return the module root. Which isn't much use in this case
#Sam:
I don't really understand your question. Basically the current path equals the ZF2-Apps Root. [...] You can always go up-levels, too via ../
Not exactly. When You create module shared within several applications ex. FileUpload Module in vendor, outside application. You would like to upload file to Application subdirectory not shared module :) In this case __DIR__ equals module path not app path and ../ wouldn,t be good solution ;)
I like ROOT_PATH as You have mentioned:
define('ROOT_PATH', dirname(__DIR__));
or even better:
getcwd()
Is there a variable where I can find out the root directory of my Grails application?
for example, I have a folder named chart under \%root%\web-app\images\ where I put my charts in. Once I deploy my Grails application on Jetty, I will get FileNotFoundException because the root path becomes /srv/www/vhosts/domain-name/jetty-version/
I would like to know if there is a variable that returns the root path (like /srv/www/vhosts/domain-name/jetty-version/webapps/myapp), and there should be because CSS uses relative path just fine.
solved.
request.getSession().getServletContext().getRealPath("/")
this actually gives me the path to where my application puts the images, css, WEB-INF, etc. folders.
System.properties['base.dir']
I know it is an old question, but this could work if you are not in an http request:
ServletContextHolder.servletContext.getRealPath('/')
If you want to establish this is GSPs try this:
${createLink(uri: '/')}