MCPcopy Create free account
hub / github.com/OpenFOAM/OpenFOAM-dev / ln

Function ln

src/OSspecific/POSIX/POSIX.C:872–910  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

870
871
872bool Foam::ln(const fileName& src, const fileName& dst)
873{
874 if (POSIX::debug)
875 {
876 //InfoInFunction
877 Pout<< FUNCTION_NAME
878 << " : Create softlink from : " << src << " to " << dst << endl;
879 if ((POSIX::debug & 2) && !Pstream::master())
880 {
881 error::printStack(Pout);
882 }
883 }
884
885 if (exists(dst))
886 {
887 WarningInFunction
888 << "destination " << dst << " already exists. Not linking."
889 << endl;
890 return false;
891 }
892
893 if (src.isAbsolute() && !exists(src))
894 {
895 WarningInFunction
896 << "source " << src << " does not exist." << endl;
897 return false;
898 }
899
900 if (::symlink(src.c_str(), dst.c_str()) == 0)
901 {
902 return true;
903 }
904 else
905 {
906 WarningInFunction
907 << "symlink from " << src << " to " << dst << " failed." << endl;
908 return false;
909 }
910}
911
912
913bool Foam::mv(const fileName& src, const fileName& dst, const bool followLink)

Callers 2

cpFunction · 0.70
mainFunction · 0.50

Calls 2

printStackFunction · 0.70
existsFunction · 0.70

Tested by

no test coverage detected