absolute-path

Check if an absolute path of a directory or a file name are valid

痴心易碎 提交于 2019-12-08 03:28:21
问题 I'm creating a bat script and I should check whether a variable contains a valid absolute path of a directory and if another variable contains a valid name of a file for Windows 8 and above. So, how would I go these checks? Thanks Bye 回答1: This is much trickier than most people realize. There is lots of misinformation about this topic available on SO and elsewhere. There are many "solutions" that appear to work, but then fail under certain circumstances. The problem can be divided into two

Getting absolute path from relative in Vista seems to fail using Win32/Shell PathCombine()

眉间皱痕 提交于 2019-12-08 03:17:03
问题 Not sure if this is intended behavior or a bug or a wrong function that I'm using, but the problem is that PathCombine() returns a wrong path on a Vista box. The relative path is (as exported by the WMP to a playlist): ..\..\..\Public\Music\Sample Music\Amanda.wma The path it's relative to is: C:\Users\userX\Music\Playlists\playlist.wpl and PathCombine() returns: C:\Users\userX\Public\Music\Sample Music\Amanda.wma however, the file is actually located here (judging by the Explorer and the

QDir mkdir with absolutepath

倖福魔咒の 提交于 2019-12-06 21:15:09
问题 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. 回答1: Try to use QDir::mkpath as dir.mkpath(path); 回答2: You can do this: QDir dir(path); if (!dir.exists()){ dir.mkdir("."); }

PHP fopen filename. Is it relative or absolute?

若如初见. 提交于 2019-12-06 12:46:19
问题 I'm having problems with my paths and fopen with reference to my web server. I have a file saved in public/dan/new/apps/lovescopes/thisfile.php . thisfile.php will create a new file in public/internalServer/lovescopes/xml/2009/12 using fopen "x+". Now my errors show in the line where fopen is: If I type in the path as relative like ../../../../internalServer/lovescopes/xml/2009/12 I end up with a Permission Denied error. If I type an absolute path like /public/internalServer/lovescopes/xml

Regex to replace relative link with root relative link

喜欢而已 提交于 2019-12-06 12:40:08
问题 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" .

PHP: Translate relative img src urls to absolute

匆匆过客 提交于 2019-12-06 11:49:56
I have fetched an HTML page using cURL into a string and loaded it up in a DOMDocument. There I can get all the img tags and their source attributes. My problem now is... how can I make these URLs absolute? The list of URLs can contain all kinds of variants, for example: foobar.jpg http://example.com/foobar.jpg /foobar.jpg ../foobar.jpg folder/foobar.jpg If the HTML is fetched from an arbitrary URL, what is a safe way of converting these image URLs into absolute ones? Is there a way you can take the base tag into consideration too? Wh1T3h4Ck5 Here is great PHP example how to do this. function

Relative path from an ASP.NET user control NavigateUrl

荒凉一梦 提交于 2019-12-06 10:28:08
问题 I have a user control that contains a GridView. The GridView has both a HyperLinkField column and a template column that contains a HyperLink control. The ASP.NET project is structured as follows, with the Default.aspx page in each case using the user control. Application Root Controls UserControl with GridView SystemAdminFolder Default.aspx Edit.aspx OrganisationAdminFolder Default.aspx Edit.aspx StandardUserFolder Default.aspx Edit.aspx Note: The folders are being used to ensure the user

PHP Dynamically get complete Absolute URL Path for specific file that will be included in other files

你离开我真会死。 提交于 2019-12-05 17:02:56
I have a configuration file. This is not a stand-alone file. I will be including this file at the top of the pages that I want to use in, using require(). I want to dynamically get the complete absolute url path to this configuration file , regardless of it's location and store it as a constant within itself. For example: Physical Location: (root dir)/my_folder/configuration.php Need URL as: www.mydomain.com/my_folder/configuration.php Physical Location: (root dir)/demos/my_folder/configuration.php Need URL as: www.mydomain.com/demos/my_folder/configuration.php Physical Location: (root dir)

What is the correct way to launch slimerjs in casperjs (with an absolute path)?

戏子无情 提交于 2019-12-05 10:19:19
Well, i can launch slimerjs by specifying the path of the slimer.bat file : C:\bin\slimerjs\slimerjs.bat and then execute my file. But if i modify casperjs file (in bin\ ) and modify the default exec for slimer : 'env_varname': 'SLIMERJS_EXECUTABLE', 'default_exec' : 'C:\bin\slimerjs\slimerjs.bat' when i execute the casper command : casperjs --engine=slimerjs test.js It doesn't work, the path to slimerjs.bat seems to be ignored. I tried this too : https://github.com/laurentj/slimerjs/blob/master/BUILD.md But the slimerjs.exe alone isn't sufficient, i need to have application.ini and omni.ja in

Perl use/require abolute path?

情到浓时终转凉″ 提交于 2019-12-05 07:55:25
If I have a .pm file, is there a way I can use it, without placing it on my @INC path? I think that would be clearer in my particular use case - clearer than using relative paths or adding this directory to @INC . Edit: Clarification: I was hoping to avoid the necessity to iterate through every item in @INC , and instead specify directly which file I am interested in. For example, in Node.JS, require('something') will search the list of paths, but require('/specific/something') will go directly where I tell it to. In Perl, I am not certain that this is the same functionality found in require ,