absolute-path

How to get absolute path from path with system path variables?

孤人 提交于 2019-12-05 03:31:11
Is there an easy way to translate a path with system path variables to an absolute path? So %ProgramFiles%\Internet Explorer\hmmapi.dll becomes C:\Program Files\Internet Explorer\hmmapi.dll I like to know if there is an API call that can do this, or do I have to do this the hard way and detect %..% sequences and replace them with the corresponding environment variable? ThiefMaster You can use the WinAPI function ExpandEnvironmentStrings : function ExpandEnvStr(const szInput: string): string; const MAXSIZE = 32768; begin SetLength(Result,MAXSIZE); SetLength(Result,ExpandEnvironmentStrings(pchar

Use Absolute path for ClassLoader getResourceAsStream()

删除回忆录丶 提交于 2019-12-05 03:25:53
I am trying to use ClassLoader getResourceAsStream() My Direcory structure is like below: Project1 -src -main -java -webapp -WEB-INF -MYLOC -someprops.properties For classloader.getResourceAsStream("MYLOC/someprops.properties") works fine. But now I have to move the properties file outside of the .war, like in C:\someprops.properties But, classloader.getResourceAsStream("C:\someprops.properties") does not work. Can it not use an absolute path? If you have a native file path then you don't need to use getResourceAsStream , just create a FileInputStream in the normal way. Properties props = new

QDir mkdir with absolutepath

穿精又带淫゛_ 提交于 2019-12-05 00:48:14
I have problem with the creation of dir with Qt. I would like to create a dir in documents'dir so, I make some things like that : QString path("C:/Users/Me/Documents/MyApp/profiles/"); Qdir dir = QDir::root(); dir.mkdir(path); But that doesn't work! I have test with "/" and "\" for the separators but in the two cases that not work. How I can create my dir? Thank you. Try to use QDir::mkpath as dir.mkpath(path); You can do this: QDir dir(path); if (!dir.exists()){ dir.mkdir("."); } QDir dir = QDir::root() creates an instance of QDir configured to point to root and copies that setting to dir .

Regex to replace relative link with root relative link

a 夏天 提交于 2019-12-04 17:42:55
I have a string of text that contains html with all different types of links (relative, absolute, root-relative). I need a regex that can be executed by PHP's preg_replace to replace all relative links with root-relative links, without touching any of the other links. I have the root path already. Replaced links: <tag ... href="path/to_file.ext" ... > ---> <tag ... href="/basepath/path/to_file.ext" ... > <tag ... href="path/to_file.ext" ... /> ---> <tag ... href="/basepath/path/to_file.ext" ... /> Untouched links: <tag ... href="/any/path" ... > <tag ... href="/any/path" ... /> <tag ... href=

How to convert absolute path to relative in c linux

半腔热情 提交于 2019-12-04 16:55:54
I would like to know how an absolute path of a symbolic link can be converted to relative based on a given directory (that includes the linked file) in c language on linux (Ubuntu) OS. I thought searching for the sub-string of the relative path, but what if it already exists higher in the folder's hierarchy? Here is a more specific description of what I want to do: Relative path: folder/folder1/folder2 Absolut path: /home/giorgos/Desktop/folder/folder1/folder2/a.pdf changed to /home/giorgos/Desktop/myfolder/folder1/folder2/a.pdf Obviously I cant' simply search for and replace "folder/",

Absolute Paths beginning with two slashes

懵懂的女人 提交于 2019-12-04 06:02:18
问题 I noticed that Wikipedia links pointing to a path on a different Wikipedia subdomain use a link with the following syntax: //<SERVER_NAME>/<REQUEST_URI> . For example, a link from a file page to the file appears (for example) as //upload.wikimedia.org/wikipedia/en/9/95/Stack_Overflow_website_logo.png . I am familiar with absolute paths (thinking twice about that now) and relative paths and how to use them. However, I have never seen this use. I assume this points to a new server name using

Absolute vs Relative Links : Technical Difference

青春壹個敷衍的年華 提交于 2019-12-04 05:51:26
问题 Which is better option or there is no difference in terms of speed or other issues like SEO, Backlinks href="http://www.example.com/contact" href="../../contact" From what i observe, Absolute paths uses paths from left to right finally move to rightmost position as in http//www.example/contact fpr relative paths: first it gets the current location, then based ../../contact or ../blog/articles move there. Technically which is faster, as mentioned in answers speed difference is ignorable/minute

gcc/gdb: How to embed absolute path to source file in debug information?

早过忘川 提交于 2019-12-04 04:24:35
i am just wondering if i can tell gcc to embed the absolute path to a source file in the debug information, even if i call gcc like gcc -g ../src/somecode.c -o ../bin/somecode.o as i see it atm, gcc just stores what you provide, so if you provide a relative path, at the end, gdb only knows the relative path as well. is there a way to bypass that without using absolute paths while compiling? like: let gcc lookup the complete path? thanks in advance rTi gcc -fdebug-prefix-map=..=$(readlink -f ..) What platform are you building for and what is the native debugging format for that platform? Not

Getting an anchor element's absolute URL with jQuery

断了今生、忘了曾经 提交于 2019-12-03 23:24:32
Given an anchor element (with something like $("a:first") ), how do you get the absolute URL that the anchor points to? If you're using jQuery 1.6+, you can use .prop() : $("a:first").prop("href") Prior to 1.6, you can access the href property directly on the DOM element: $("a:first")[0].href; to get the URL attached you can do something like... var url = $("a:first").attr('href'); this will give you the URL but doesnt guarantee absolute or relative. To find the absolute URL you can further check if(!url.startsWith("http")) { url = "http://www.mysite.com" + url} var x = "http://lol.com/" + $(

What's a “canonical path”?

纵然是瞬间 提交于 2019-12-03 18:26:30
问题 That's a theory question. I've searched over the internet with no satisfying luck, I just want to understand what's this jargon. I've seen examples of Java, JSON, etc but I couldn't find in Google nor here in StackOverflow a simple explanation, no code needed =P So, an absolute path it's a way to get to a certain file or location describing the full route to it, the full path, and it's OS dependent (the absolute paths for Windows and Linux for example, are different) A relative path it's a