Home » U++ Library support » U++ Core » POSIX home directory symbol '~' is causing trouble
POSIX home directory symbol '~' is causing trouble [message #57620] |
Mon, 11 October 2021 00:13  |
Lance
Messages: 656 Registered: March 2007
|
Contributor |
|
|
#include <Core/Core.h>
using namespace Upp;
CONSOLE_APP_MAIN
{
FileOut fo("~/abc.txt");
fo<<"U++ rocks!";
}
The above code won't work on Ubuntu. No expection thrown either. It just quietly does nothging. But when I replace ~ with something like /home/user1, it works just fine.
I also notice this home directory symbol causing trouble in similar situation: I use it in LocalProcess and pass it a command that is known to not run, hence a exit code 1 is expected to be returned by the OS. Yet when I use ~ to denote home directory, the LocalProcess always return 0 exit code.
Is ~ a bash thing(means bash or similar shells interpret it to produce a conforming path) so that we really should not use it on U++?
|
|
|
|
|
|
Goto Forum:
Current Time: Sat May 10 09:12:21 CEST 2025
Total time taken to generate the page: 0.02787 seconds
|