symlink

What replaces the now-deprecated Carbon.File.FSResolveAliasFile in Python on OSX?

与世无争的帅哥 提交于 2019-11-29 16:57:00
In Python 2, I can use the following code to resolve either a MacOS alias or a symbolic link: from Carbon import File File.FSResolveAliasFile(alias_fp, True)[0].as_pathname() where alias_fp is the path to the file I'm curious about, stored as a string ( source ). However, the documentation cheerfully tells me that the whole Carbon family of modules is deprecated . What should I be using instead? EDIT: I believe the code below is a step in the right direction for the PyObjC approach. It doesn't resolve aliases, but it seems to detect them. from AppKit import NSWorkspace def is_alias (path): uti

How to get symlink target in Python?

耗尽温柔 提交于 2019-11-29 16:32:53
问题 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

difference between sh and bash when symlink is used

寵の児 提交于 2019-11-29 11:30:06
I have a shell script which uses process substitution The script is: #!/bin/bash while read line do echo "$line" done < <( grep "^abcd$" file.txt ) When I run the script using sh file.sh I get the following output $sh file.sh file.sh: line 5: syntax error near unexpected token `<' file.sh: line 5: `done < <( grep "^abcd$" file.txt )' When I run the script using bash file.sh , the script works. Interestingly, sh is a soft-link mapped to /bin/bash . $ which bash /bin/bash $ which sh /usr/bin/sh $ ls -l /usr/bin/sh lrwxrwxrwx 1 root root 9 Jul 23 2012 /usr/bin/sh -> /bin/bash $ ls -l /bin/bash

Getting the logical path in VIM when there's a symlink

余生颓废 提交于 2019-11-29 10:19:09
I have the following setup: mkdir /1 mkdir /1/2 mkdir /1/2/3 ln -s /1/2/3 /1/3 If I do cd /1/3 , and then pwd , I get /1/3 . If I use pwd -P , I can get /1/2/3 , or pwd -L to force /1/3 . In VIM, I'm looking for a way to get the /1/3 . If I open a file in /1/3/foo.txt , and I use something like fnamemodify(bufname(winbufnr(0)), ':p:h') , it returns /1/2/3 . How can I tell it to give me the same directory that pwd would give? It appears you can't, other than via system('pwd -L') . According to the vim_use mailing list Vim automatically resolves symlinks nowadays. See the text around :h E773 for

Renaming a file without using renameTo() - Java

懵懂的女人 提交于 2019-11-29 10:14:13
Disregarding my last post, I've found the source of the problem. I'm using a.renameTo(b) when b doesn't exist. The reason it doesn't exist is because there is a symbolic link so if b is /usr/name/folder/file , then b really is /mnt/MountTest because the symlink is to that directory. So the question is, is there an alternative way to rename a file in Java using a string value? If not, how can this rename procedure be done differently? A rename would rename it... if it were on the same filesystem. If a renameTo() fails, you'll need to copy it to the new location, then delete the original. big

Add symlink file as file using Git on Windows

痞子三分冷 提交于 2019-11-29 07:43:00
问题 I have a big (more than 1000 files) VS C# project in git. I need to create a small demo project and use ten files from the big project. To create this new project, I added ten files with mklink (symlink) from the big project to the small. All changes in corresponding files in the big and small project are identical. Now I need to add the small project to a different (my own) git repo. But symlink will not add in git : (error: readlink("X.cs"): Function not implemented) How to add the X.cs

os.path.islink on windows with python

六眼飞鱼酱① 提交于 2019-11-29 06:15:23
On Windows 7 with Python 2.7 how can I detect if a path is a symbolic link? This does not work os.path.islink() , it says it returns false if false or not supported and the path I'm providing is definitely a symbolic link so I'm assuming it's not supported on windows? What can I do? The root problem is that you're using too old a version of Python. If you want to stick to 2.x, you will not be able to take advantage of new features added after early 2010. One of those features is handling NTFS symlinks. That functionality was added in 3.2 in late 2010. (See the 3.2 , 3.1 , and 2.7 source for

TYPO3 6.2 typo3_src should be a link

别来无恙 提交于 2019-11-29 05:11:07
I wanna setup a TYPO3 6.2 Installation on MAMP PRO but when I start I get the error: /typo3_src should be a link, but it does not exist Links cannot be fixed by this system So what to do now? Structure is: Application/MAMP/htdocs/typo3/ Any suggestions? You have to create symlinks manually, checklist: Open the terminal Move downloaded typo3_src-6.2.4.zip to host's root mv ~/Downloads/typo3_src-6.2.4.zip /Application/MAMP/htdocs/typo3/ Go to destination folder: cd /Application/MAMP/htdocs/typo3/ Still in this location unzip downloaded package (you can remove zip file after that) unzip typo3_src

Magento/Zend not allowing symbolic links

非 Y 不嫁゛ 提交于 2019-11-29 04:37:29
Anyone know why Magento won't allow symbolic links for template .phtml files that are outside the app/design folder? If I do a symlink within that folder, it works fine, but if it's linked outside that, it doesn't work. So it seems like it's some permissions/security thing, but I can't find any info anywhere. Possibly a Zend setting? http://zend-framework-community.634137.n4.nabble.com/Zend-Tool-not-working-with-symbolic-links-in-include-path-td662569.html Anyone? WORKAROUND: Thanks to Alan's suggestion below I found a workaround - as I'll only be using this myself for local development I'm

In .NET, How to obtain the target of a symbolic link (or Reparse Point)?

断了今生、忘了曾经 提交于 2019-11-29 04:19:33
In .NET, I think I can determine if a file is a symbolic link by calling System.IO.File.GetAttributes(), and checking for the ReparsePoint bit. like so: var a = System.IO.File.GetAttributes(fileName); if ((a & FileAttributes.ReparsePoint) != 0) { // it's a symlink } How can I obtain the target of the symbolic link, in this case? ps: I know how to create a symbolic link. It requires P/Invoke: [Interop.DllImport("kernel32.dll", EntryPoint="CreateSymbolicLinkW", CharSet=Interop.CharSet.Unicode)] public static extern int CreateSymbolicLink(string lpSymlinkFileName, string lpTargetFileName, int