If I'm not mistaken, /proc/pid/cwd will point to ~/Desktop/testfolder/, which in turn points to ~/testfolder/. To resolve the cwd-symlink, we use os.path.realpath. But this function resolves all symlinks it encounters, and will thus resolve the cwd-symlink to ~/testfolder/ instead of ~/Desktop/testfolder/.
So another solution would be to find a function which follows a symlink for only one level (cwd-symlink ->~/Desktop/testfolder/).
If I'm not mistaken, /proc/pid/cwd will point to ~/Desktop/ testfolder/ , which in turn points to ~/testfolder/. To resolve the cwd-symlink, we use os.path.realpath. But this function resolves all symlinks it encounters, and will thus resolve the cwd-symlink to ~/testfolder/ instead of ~/Desktop/ testfolder/ . testfolder/ ).
So another solution would be to find a function which follows a symlink for only one level (cwd-symlink ->~/Desktop/