Comments (8)
In this function -
/*!
* \brief Populates element with a path string (internal use only!)
*
* \param[out] element element name
* \param tmp TRUE to use G_make_mapset_element_tmp() instead of
* G_make_mapset_element()
*/
void G__temp_element(char *element, int tmp)
{
const char *machine;
strcpy(element, ".tmp");
machine = G__machine_name();
if (machine != NULL && *machine != 0) {
strcat(element, "/");
strcat(element, machine);
}
if (!tmp)
G_make_mapset_object_group(element);
else
G_make_mapset_object_group_tmp(element);
G_debug(2, "G__temp_element(): %s (tmp=%d)", element, tmp);
}
strcat(element, "/");
should be
strcat(element, HOST_DIRSEP );
from grass.
Windows file paths should use backward and not forward slashes.
since ages, MS Windows itself supports both, backward and forward slashes:
C:\>cd d://wd
C:\>d:
d:\wd>cd ..
d:\>c:
C:\>cd d:\\wd
C:\>d:
d:\wd>
from grass.
Apparently, not on my machine.
C:\Users\Girish>dir c:\mydata\grassscripts\script1.txt
Volume in drive C is OS
Volume Serial Number is C84E-E522
Directory of c:\mydata\grassscripts
12-12-2023 14:35 29,373 script1.txt
1 File(s) 29,373 bytes
0 Dir(s) 234,900,754,432 bytes free
C:\Users\Girish>dir c:/mydata/grassscripts\script1.txt
Invalid switch - "mydata".
C:\Users\Girish>dir c:/mydata/grassscripts/script1.txt
Invalid switch - "mydata".
C:\Users\Girish>dir c:\mydata\grassscripts/script1.txt
Parameter format not correct - "script1.txt".
C:\Users\Girish>ver
Microsoft Windows [Version 10.0.22621.2715]
C:\Users\Girish>
It appears to parse correctly as long as it sees backslashes, but fails at the first forward slash in the path.
regards,
from grass.
strcat(element, "/");
should be
strcat(element, HOST_DIRSEP );
Would it harm to change this, @hellik (others) ?
from grass.
strcat(element, "/");
should be
strcat(element, HOST_DIRSEP );
Would it harm to change this, @hellik (others) ?
Wouldn't do any harm I think, it is also used elsewhere without complications. Probably safer that way. I'm curious however why this hasn't been an issue so far (with g.tempfile).
from grass.
Apparently, not on my machine.
C:\Users\Girish>dir c:\mydata\grassscripts\script1.txt Volume in drive C is OS Volume Serial Number is C84E-E522 Directory of c:\mydata\grassscripts 12-12-2023 14:35 29,373 script1.txt 1 File(s) 29,373 bytes 0 Dir(s) 234,900,754,432 bytes free C:\Users\Girish>dir c:/mydata/grassscripts\script1.txt Invalid switch - "mydata". C:\Users\Girish>dir c:/mydata/grassscripts/script1.txt Invalid switch - "mydata". C:\Users\Girish>dir c:\mydata\grassscripts/script1.txt Parameter format not correct - "script1.txt". C:\Users\Girish>ver Microsoft Windows [Version 10.0.22621.2715] C:\Users\Girish>
It appears to parse correctly as long as it sees backslashes, but fails at the first forward slash in the path.
regards,
After c: there should be // or \ (2 slashes) then it should work.
from grass.
strcat(element, "/");
should be
strcat(element, HOST_DIRSEP );
Would it harm to change this, @hellik (others) ?
Should work, and save.
from grass.
There are at least four instances to be updated then::
ag 'element, "/"'
lib/display/r_raster.c
111: strcat(element, "/");
113: strcat(element, "/");
lib/gis/tempfile.c
166: strcat(element, "/");
192: strcat(element, "/");
from grass.
Related Issues (20)
- [Bug] CI on main failing due to dependencies HOT 4
- Grass GIS version 8.3.2.1 problem HOT 8
- [Bug] CI: Bandit: 1 configuration not found (python-code-quality.yml) HOT 3
- [Bug] PATH setting discrepancy between the main exectable and Python API for scripts on Windows
- [Bug] wxGUI: Nonsense commands end in Success in gconsole OnCmdDone method
- [Bug] Windows CI builds fail to compile r.flow HOT 6
- Renovate naming convention issue HOT 2
- Raster layers cannot be displayed[Bug] HOT 1
- [Bug] wxGUI/history: update cross to green check after updating to current region
- Tests are failing in CI with an ISO format error HOT 6
- r.recode results in integer when floating numbers are expected [Bug] HOT 6
- [Bug] Windows GUI can't launch for 8.4.0dev (nightly) HOT 7
- [Build] Exclude specific module (r.geomorphon) at compilation HOT 17
- [Feat] temporal: revert #3723 (fix for SQLite version < 3.33)
- [Bug] [Windows] Crash of the GRASS-GIS 8.3 `v.surf.rst.exe` (OSGeo4W) and Windows module `ntdll.dll` HOT 13
- [Bug] Windows 8.4.0dev cannot launch GUI with error in `gui\wxpython\lmgr\statusbar.py` HOT 12
- [Bug] Windows OSGeo4W builds seem to report outdated build info HOT 2
- import nc file in grass gis HOT 2
- [Feat] library: Add Standard parser options for date and time HOT 1
- [Feat] i.group: print image group content with semantic_labels in JSON HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grass.