Fix compiler warning

Fix compiler warning: ignoring return value of char* realpath(const char*, char*), declared with attribute warn_unused_result
And issue a warning if the canonical path cannot be obtained