Am 17.07.2021 um 22:32 schrieb Sven Schreiber:
A space in the file name (path) alone doesn't cause an error, at
least
not in "readfile" nor in mwrite. I tested this with a subdirectory with
spaces.
Maybe the case where there's a blank in the user name part of the path
is different (always on Windows...). I will try more testing to pinpoint
the cause of the error.
Hm, perhaps a blank in the user name really does make a difference.
Here's what I did for testing:
1. Create a new user account on the (Win 10) system, named "account with
blank".
2. Create the trivial text file "C:\Users\account with
blank\Documents\gretl\oha.txt", which contains just a single line of
short but arbitrary text.
3. Run the following script, with the workdir output shown further down,
but it is the default setting, where the oha.txt file was created in the
previous step:
<hansl>
print $workdir
string psep = $windows ? sprintf("\\") : "/"
# check whether dir exists, is reachable by gretl
m = I(2)
mwrite(m, $workdir ~ psep ~ "mym.mat")
# now the readfile thing
string fpath = $workdir ~ psep ~ "oha.txt"
print fpath
string s = readfile(fpath)
print s
<7hansl>
4. Results:
- the part up to mwrite() works (and mym.mat is created where it should be)
- Then the error strikes:
<output-part>
? print fpath
C:\Users\account with blank\Documents\gretl\oha.txt
? string s = readfile(fpath)
C:\Users\account with blank\Documents\gretl\oha.txt: No such file or
directory
Datei »C:\Users\account with blank\Documents\gretl\oha.txt« konnte nicht
geöffnet werden: No such file or directory
</output-part>
This just tests readfile(), I suppose the join problem might be the same
in the background.
thanks
sven