Is it possible to import a certificate file using a (relative) path? I am trying to follow the example here:
http://msdn.microsoft.com/en-us/library/te7383x5.aspx?cs-save-lang=1&cs-lang=csharp#code-snippet-2
cert.Import( relative path )
I am not having any success. Keep running into "file not found" exception.
Is a fully-qualified path required?
Win32 documentation discourages use of relative paths so use of the absolute path is strongly recommended.
Related
My original motivation was to run a Deno script from Crontab on Ubuntu.
First I did not know that paths are relative to the working directory, not the executing module.
My script was reading and writing files to a disk, so I got errors like
error: Uncaught NotFound: No such file or directory (os error 2)
I was pointed out that this problem can be solved with import.meta.url.
I modified the path to resolve it from import.meta.url and this solution worked fine with read/write operations.
But I encountered another problem with .env file.
It was a surprise to me that even the dotenv module uses paths relative to the working directory.
The dotenv module has the option to specify the path with config({path:___}), but I think it is too much to overwrite the default location.
Eventually, changing the working directory to the script's root directory before running the script in crontab was a simpler solution.
* * * * * cd ____; deno run ___
But I still have doubts if this is the most efficient way.
Is there something better to changing a directory in such cases?
It would be nice to have a mode when running deno, which would make paths relative to the executing module excluding modules which are imported with URLs.
I think you're looking for Deno.mainModule, which is a reference to the file URL of the entrypoint module you passed to deno. You can use it with the deno.land/std/path module to get the directory of the entrypoint for your program, and then use Deno.chdir() to change your current working directory so that all relative paths (which are implicitly relative to Deno.cwd()) are then relative to that directory.
/repo/relative-path.ts:
import * as path from 'https://deno.land/std#0.102.0/path/mod.ts';
export {path};
export const mainModuleDir = path.dirname(path.fromFileUrl(Deno.mainModule));
/repo/main.ts:
import {mainModuleDir, path} from './relative-path.ts';
Deno.chdir(mainModuleDir);
const entrypointRelativePath = path.resolve('hello', 'world.json');
console.log(entrypointRelativePath);
Then, run your script:
$ cd /different/unrelated/path
$ deno run --allow-read /repo/main.ts
/repo/hello/world.json
You can use mainModuleDir as a base for any entrypoint-relative paths you need.
Log file is created if an absolute path is provided in the log4j.properties in a runnable jar created using eclipse. However, if relative file path is given , file is not created
log4j.appender.appLogger=org.apache.log4j.RollingFileAppender
log4j.appender.appLogger.File=.//logs//MyApp.log
Please correct this in your log4j.properties.
log4j.appender.appLogger.File=/logs/MyApp.log
For example:
In Ubuntu(Linux).
/home/bizruntime/Desktop/logs/MyApp.log
In Windows.
C:\\Desktop\logs\MyApp.log
If i have my log file in some folder of Desktop i need to specific the exact path.
i generated the scaffold of a famo.us project with Yeoman (yo famous)
i set up i small working project
i tried to launch it with 'grunt serve' command
it all works but no image is loaded because the folder content/images is not loaded
how can i include it?
thanks
I'm Myles the author of the Famous-Generator. The images in '/content/images/' should be able to be loaded as an absolute or relative path... although I have just updated the generated 'main.js' to use an absolute path for the sake of being explicit.
Remember that when you famous code is run it will be running inside of index.html, and therefore have the same "relative path" for included assets. As well, since you are serving via a development server, you are able to reference anything with absolute paths relative to the root directory of the project.
You should not have to touch requireConfig at all to be honest. It is only used to add vendor code installed in 'lib' to your path within require so you can reference modules by name rather than path. 'underscore' rather than '../lib/underscore'. This becomes nice as you begin to nest folders and don't want to have to manage relative paths. This also makes your code a lot more portable!
A nice sidebar, you should install all vendor code with 'bower install --save $LIB_NAME'. This will save the library / version to your bower.json and inject the path for the module into you requireConfig. Basically you can bower install anything and just start requiring!
yo famous is working just fine!
it was my mistake to try to set relative paths inside requireConfig including images: that is not working but i don't know if it is supposed to!
you have to use relative paths for every image and everything will be ok!
I work with Asterisk 11.2.1 and I want to compile it with --prefix
mindia#localhost asterisk-11.2.1]$ ./configure --prefix=../
This command throws exception
configure: error: expected an absolute directory name for --prefix: ..
I want to use relative path.Can anybody help me?
you can write it as below
mindia#localhost asterisk-11.2.1]$ ./configure --prefix=/relative/path
not
--prefix=../something
You got the clear response from configure
configure: error: expected an absolute directory name for --prefix: ..
So you are not allowed to use relative path, and you need to provide absolute path. The reason of this behavior, I think, is in the fact that relative path has no sense due to the prefix directory path. If you still have to use relative path, then just use some of the bash or your operation system utilities to convert the relative path to absolute path and substitute that path to your configure command.
I built air app with icon in the past with flash builder, and everything was fine.
Now I have to build another app with adt(air developer tool), but I experience weird problems.
If I just place icon path relative to 'src' folder to app descriptor (as usual), it says:
error 303: Icon icon.png is missing from package.
If I use icon.png without path in app descriptor and then put this file everywhere(to root dir, to assets, to src, to build destination and so on), it again says error 303: Icon icon.png is missing from package.
If I try to add icon path to adt args like <arg value="icon.png"/> ( and put it to output folder as it seems that all path are relative to it in my case), it says The path icon.png is restricted. If you were trying to package Icon.png you should correct the case.
When I point to original file location ( <arg value="../src/assets/icon.png"/>), it outputs File ..\src\assets\icon.png is not relative to directory E:\projQ\flex\MyProject\bin (this bin directory is actually output directory). I've read unapproved comment on adobe forum that this is due to some sandbox limitations, but I'm not even sure that sandbox exists for adt( if it exists, then why? )
So, what shall I do to successfully add icon to that app?
I guess that using tools like resHacker to project's .exe will not help as .exe is just a launcher for .swf file, and anyway I consider that this awful way leads to the dark side of programming.
(P.S. can't add 'adt' tag that relates to adobe, not android.)
Nice. At last I've found the solution. So, the requirements for including icon while packaging manually with adt are:
Add file name to application descriptor without using any .. .
I beg you, don't even try to name your icon file icon.png. It is obvious name, and it was obvious for creators of adt. So it seems that they are renaming some files to icon.png or generating output to such file. Or put this file into some subdirectory of directory that is used as root by adt. Actually, error output exactly tells you to avoid using path icon.png. Correct the case phrase (which confused me) means rename your icon or move it deeper in directory hierarchy
Add path to your icon as command line argument to adt.
After generation you will see your icon inside generated output folder. You can remove it and application will still appear with your icon as expected.
This is more of an elaboration on the first point in the answer above to clarify for people like me who have been struggling with this issue.
The error reads "is not relative to directory", but what it means is "is not a child of directory". Basically even if you're trying to use a valid relative path, it expects it to point to something under your working directory. In my case the following trick worked:
./../..build/executable.swf
Replaced with
-C ./../.. build/executable.swf
-C makes ADT change directory to the one two levels above, and then you can specify the necessary file.
After playing with ADT a bit more, I now realise why it does that - the path you give to it will become the path within the package. So in the example above the file will be available inside the package at build/executable.swf. If you wish to make it available at package's root level, change the -C directive to the following:
-C ./../../build executable.swf