Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
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 Go to previous message
Lance is currently offline  Lance
Messages: 526
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++?
 
Read Message
Read Message
Read Message
Read Message
Previous Topic: Strings with national specific characters are wrongly sorted - Sort
Next Topic: Magic enum
Goto Forum:
  


Current Time: Thu Apr 18 10:57:46 CEST 2024

Total time taken to generate the page: 0.01544 seconds