symlink

Is there a version of os.getcwd() that doesn't dereference symlinks? [duplicate]

断了今生、忘了曾经 提交于 2019-11-30 22:41:50
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: How to get/set logical directory path in python I have a Python script that I run from a symlinked directory, and I call os.getcwd() in it, expecting to get the symlinked path I ran it from. Instead it gives me the "real" path, and in this case that's not helpful. I need it to actually give me the symlinked version. Does Python have a command for that? 回答1: Workaround: os.getenv('PWD') 回答2: In general this is

Create a custom symbolic link to a library at install time with CMake

折月煮酒 提交于 2019-11-30 21:02:42
Under Linux with CMake, I'm building a shared library libIex-2_0.so.10.0.1 ADD_LIBRARY (Iex SHARED [*.cpp] ) SET_TARGET_PROPERTIES(Iex PROPERTIES OUTPUT_NAME "Iex-2_0") The 10.0.1 version is set with a call to SET_TARGET_PROPERTIES ( Iex PROPERTIES VERSION 10.0.1 SOVERSION 10 ) In the installation folder, these links are created libIex-2_0.so -> libIex-2_0.so.10 libIex-2_0.so.10 -> libIex-2_0.so.10.0.1 libIex-2_0.so.10.0.1 However, to match previous builds made with another build system, I need to add a legacy symbolic link, stripping the 2_0 suffix : libIex.so -> libIex-2_0.so.10.0.1 What

How to get/set logical directory path in python

拜拜、爱过 提交于 2019-11-30 19:19:58
In python is it possible to get or set a logical directory (as opposed to an absolute one). For example if I have: /real/path/to/dir and I have /linked/path/to/dir linked to the same directory. using os.getcwd and os.chdir will always use the absolute path >>> import os >>> os.chdir('/linked/path/to/dir') >>> print os.getcwd() /real/path/to/dir The only way I have found to get around this at all is to launch 'pwd' in another process and read the output. However, this only works until you call os.chdir for the first time. nosklo The underlying operational system / shell reports real paths to

gcc link shared library against symbolic link

感情迁移 提交于 2019-11-30 19:11:26
I have two libraries, for example two toaster libraries libtoaster_a.so and libtoaster_b.so and all the associated major/minor/rev symlinks eg libtoaster_a.so.1.0.0 etc. Both libraries implement the same toaster interface, but simply do the processing differently. Hence when I build an application that uses the library it doesn't matter which is used (from the applications perspective they are the same). Because I would like to decide which library to use after the application has been compiled and distributed I make a symbolic link libtoaster.so which points to libtoaster.so.1 which can then

Ignore symbolic links in .gitignore

烈酒焚心 提交于 2019-11-30 18:43:33
Is it possible to tell Git to ignore symlinks ? I'm working with a mixed Linux / Windows environment and, as you know, symlinks are handled very differently between the two. Use git version >= 1.6 Git used to treat sym-links the same as regular files, but newer git versions (>= 1.6) check if a file is beyond a symbolic link and will throw a fatal error. e.g.: # git init # mkdir newdir # touch newdir/foo # git add newdir/foo # git commit -m 'add foo' # mv newdir /tmp/ # ln -s /tmp/newdir # touch newdir/bar # git add newdir/bar fatal: 'newdir/bar' is beyond a symbolic link # git add/tmp/newdir

How to get symlink target in Python?

社会主义新天地 提交于 2019-11-30 17:12:05
Using Python, I need to check whether hundreds of symlinks are correct and recreate them when not. What I do now is to compare real paths of what I want and what I have, but it's slow because it's over NFS with an automount. Otherwise I'm going to run a subprocess with the command 'ls -l' and work on the list of strings returned. I would prefer a better solution, using a Python library... Edit1: I have: link_name -> link_target and then link_target -> a_real_file . What I need is to extract link_target from link_name , not a_real_file . I don't care if the real file does not exist. Edit2:

Access Data Directory in Openshift with URL

筅森魡賤 提交于 2019-11-30 17:02:23
I want to access a data directory in OpenShift. I created a folder called uploads and I also created the symlink using putty, still I cant access the file and it shows a 404 page. Can anybody tell me the process in detail (step by step), as I recently started working with OpenShift. Also, whenever I update the repository using a git client it deletes the symlink. I'm working on a maven project. Here are the steps which I followed: cd <openshift deploy dir in my local system> touch .openshift/action_hooks/deploy vi .openshift/action_hooks/deploy Pasted the following code ln -sf ${OPENSHIFT_DATA

Access Data Directory in Openshift with URL

旧街凉风 提交于 2019-11-30 16:29:09
问题 I want to access a data directory in OpenShift. I created a folder called uploads and I also created the symlink using putty, still I cant access the file and it shows a 404 page. Can anybody tell me the process in detail (step by step), as I recently started working with OpenShift. Also, whenever I update the repository using a git client it deletes the symlink. I'm working on a maven project. 回答1: Here are the steps which I followed: cd <openshift deploy dir in my local system> touch

How do I grant SeCreateSymbolicLink on Windows Vista Home edition

走远了吗. 提交于 2019-11-30 15:19:02
I want to be able to use mklink to create symbolic links on my Windows Vista Home edition computer. However, I must grant SeCreateSymbolicLink before mklink will be able to function on Vista Home edition (by default the right is revoked). Home edition provides no UI or tool facility to grant/revoke discreet rights. A Wikipedia link on NTFS symbolic links says the ntrights.exe tool that comes in Windows Server 2003 Resource Kit Tools can be used to grant this right on Home edition. However, after installing these tools, that proved to be incorrect. That version of ntrights.exe does not

Windows how to create directory symlink

大城市里の小女人 提交于 2019-11-30 14:48:15
im trying to create a symlink to directory Windows 8.1 using git-bash command windows run as administrator having the folder structure like this: -magento plugin -magento where my plugin is a git repository i want to symlink it to magento as mentioned here: http://inchoo.net/ecommerce/magento/how-to-setup-git-for-magento-extension-development/ so i run command to create symlink $ ln -s D:/wamp/www/plugin-magento/app/design/adminhtml/default/default/template/company/name/ d:/wamp/www/magento/app/design/adminhtml/default/default/template/ company/name where: D:/wamp/www/plugin-magento/app/design