readlink

What alternatives are there for “ readlink -e”

那年仲夏 提交于 2021-02-11 14:44:14
问题 I use a makefile which in order to create a library uses a .pc file which looks like this current_path=`readlink -e .` cat > lib/libmy.pc << EOM prefix=$current_path includedir=\${prefix}/inc libdir=\${prefix}/lib Name: my Description: My library Version: 1.0 Cflags: -I\${includedir} Libs: -L\${libdir} -lmy Libs.private: -lm EOM The problem is that on mac the -e flag doesn't work (even I installed coreutils). I there a method to replace the flag? 回答1: The most portable way I could find:

Having trouble implementing a readlink() function

眉间皱痕 提交于 2019-11-28 12:14:38
I've been trying to figure out a way to get some sort of ability to be able to return the true abspath of a symbolic link in Windows, under Python 2.7. (I cannot upgrade to 3.x, as most DCCs such as Maya/3ds max do not use that version of Python) I've looked at the sid0 ntfs utils (whose islink() function works, but readlink() function always returns an empty unicode string for me for some reason), and the juntalis ntfs libs (which unfortunately, I couldn't get to work), along with a helpful script someone posted: import os, ctypes, struct from ctypes import windll, wintypes FSCTL_GET_REPARSE