-
Notifications
You must be signed in to change notification settings - Fork 340
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
See if using ; under Windows work better for dirs #1124
Conversation
In movie, we select the directory separator based on the scripting language, but since this fails on Windows perhaps we should always select ; there. Give it a try on the animation tests.
Still not working. The error message is:
|
The first one with any slashes, perhaps there are single backslashes instead? Able to run this through od -c? |
The content of #!/usr/bin/env bash
# Preflight script
export GMT_SESSION_NAME=$$
source movie_init.sh
gmt math -T0/360/20 T SIND = sin_point.txt
gmt math -T0/360/2 T SIND = sin_curve.txt
gmt begin
# Set fixed background output ps name
gmt figure movie_background ps
gmt set PS_MEDIA 4ix2i
gmt set DIR_DATA C:\Users\seisman\Desktop\anim01;C:\Users\seisman\Desktop\anim01\anim_01
gmt basemap -R0/360/-1.2/1.6 -JX3.5i/1.65i -X0.35i -Y0.25i -BWSne+glightgreen -Bxa90g90f30+u'\232' -Bya0.5f0.1g1 --FONT_ANNOT_PRIMARY=9p
gmt end We can't use |
Hm, so this whole concept of path separation was inherited from how PATH is set in the shell, but in our case DATA_DIR is only parsed internally by GMT - it is never given to any other tool. So having : or ; is kind of arbitrary, except ; caused the problem you mentioned. If we instead had selected another harmless character that is unique and not used in any path or has special meaning to the shell or DOS, then we would be OK. Staring at my keyboard, maybe , ? Would the comma have any unintended consequences, e.g. I assume
What do you think? |
Good idea to have a platform-independent path separator. |
Since DATA_DIR is just for GMT internal use we should not use OS-specific PATH separators but just use a harmless comma.
Try again. As soon as we parse DIR_DATA I replace any occurrences of the OS-specific path separator with a comma (hence we are backwards compatible). |
Still not working. The problem is, this command
is interpreted by bash first. Thus what GMT actually sees is:
The following command works as expected.
|
What happened to the environmental parameter that turns off the craziness? |
No. It's not caused by the MSYS path conversion. Even on Linux or macOS, you can try
and you'll see
The reason is that |
I've seen that using \ (two backslashes) should work. Perhaps we should scan and if we find one we insert a 2nd? Can you test in manually using two works before coding that up? |
Yes, |
To be sure, those backslashes are coming from getcw calls in movie, since you're gmt.conf probably has nothing for DATA_DIR when those tests are run. Hence, this is strictly a movie.c issue where we have to double the backslashes when writing out. I think \\ in a printf statement only prints one , so maybe need to insert 3... |
See if this works then. |
If it works, please do some command-line experiments with gmt set DIR_DATA to see if we robustly handle ingesting \\ and outputting commas. |
The proposed solution works for the paths but the
that is again solved replacing
by
However, next error is: No errors and no movie files. Just damn silence. |
@joa-quim, is a mixed path (mix of forward and backward slashes) OK as well)? |
I believe so.
…Sent from my iDedo
No dia 08/07/2019, às 17:59, Paul Wessel <[email protected]> escreveu:
@joa-quim, is a mixed path (mix of forward and backward slashes) OK as well)?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.
|
So to summarize, we should
However, when getcwd returns a path with backslashes and we need to write it out (e.g., from movie.c or put_defaults) with fprintf, we MUST either replace all of them with / or insert that second backslash, otherwise we end up writing paths like C:somedirsarenotsepartedfile.txt. Hence,
hence, the action required is to implement (2) above. Agreed? |
I think you're right. I just know that Windows supports both |
No longer use backslash in movie for dir separator. Replace any incoming backslash in paths with forward slash.
Implemented. |
Maybe so miracle will fix remaining shit. My previous attempt ended up with a file in |
This PR may break our testing system. |
Yikes, what did I do? I added this:
and call it in gmt_init.c:
and in movie.c:
|
I suspect that |
Do we need a |
Blushing.... |
Ans in fact I have another shit with this. Sometimes it decides to do Portrait others, Landscape. It's not exactly random. It tends to be more Landscape (and thus clipped) on first run and correct (Portrait) on repetitions. |
After merging this PR, the animation tests all pass on our Windows builds. See #948 if you want to view the build output. |
Hmm, they all still fail for me, though now for a different reason. For example
|
…s.py (GenericMappingTools#1124) Co-authored-by: Dongdong Tian <[email protected]>
In movie, we select the directory path separator based on the scripting language, but since this fails on Windows perhaps we should always select ; there. Give it a try on the animation tests, @seisman.