Skip to content
Snippets Groups Projects
Commit ced92bbb authored by Lars Bilke's avatar Lars Bilke
Browse files

Merge branch 'win-long-paths' into 'master'

Enable long paths in executables on Windows

See merge request ogs/ogs!4872
parents 4fef0f7a fa68763d
No related branches found
No related tags found
No related merge requests found
...@@ -127,6 +127,26 @@ function(ogs_add_executable targetName) ...@@ -127,6 +127,26 @@ function(ogs_add_executable targetName)
list(APPEND files ${file_path}) list(APPEND files ${file_path})
endforeach() endforeach()
if(WIN32)
# Generate manifest file with long paths enabled. Is added to source
# files which embeds it into the executable. To work long paths have
# to be enabled in the registry as well:
# https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=registry#enable-long-paths-in-windows-10-version-1607-and-later
set(target_mn_filename "${targetName}_longpath.manifest")
set(mn_file_output "${CMAKE_CURRENT_BINARY_DIR}/${target_mn_filename}")
set(mn_contents [=[<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings xmlns:ws2="http://schemas.microsoft.com/SMI/2016/WindowsSettings">
<ws2:longPathAware>true</ws2:longPathAware>
</windowsSettings>
</application>
</assembly>]=])
file(GENERATE OUTPUT "${mn_file_output}" CONTENT "${mn_contents}")
list(APPEND files ${mn_file_output})
endif()
add_executable(${targetName} ${files}) add_executable(${targetName} ${files})
target_compile_options( target_compile_options(
......
...@@ -5,6 +5,19 @@ author = "Lars Bilke and Feliks Kiszkurno" ...@@ -5,6 +5,19 @@ author = "Lars Bilke and Feliks Kiszkurno"
weight = 1 weight = 1
+++ +++
## Windows only: `ogs`` or any of its tools cannot open an existing file with a long path
Windows has a [default path length limit of 260 characters](https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation). Especially in workflows this limit can be exceeded easily. To enable long paths on Windows you need to alter the Windows registry which requires administrative user privileges:
- Open a PowerShell command prompt as an Administrator
- Run the following script:
```powershell
New-ItemProperty -Path "HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem" -Name "LongPathsEnabled" -Value 1 -PropertyType DWORD -Force
```
- You may have to restart the computer
## `XSDError: Loaded schema file is invalid` error encountered when running DataExplorer ## `XSDError: Loaded schema file is invalid` error encountered when running DataExplorer
You may encounter the following error (or similar) on opening `.gml`, `.cnd`, `std` or `.prj` files in the Data Explorer or file You may encounter the following error (or similar) on opening `.gml`, `.cnd`, `std` or `.prj` files in the Data Explorer or file
......
+++
date = "2018-11-14T11:00:13+01:00"
title = "General"
author = "Lars Bilke"
weight = 2
toc = true
+++
<!-- TODO: This part so far is only repetition. It could be deleted. -->
## Data Explorer
### `XSDError`: Loaded schema file is invalid
You may encountering the following error (or similar) on opening `.gml`, `.cnd`, `std` or `.prj` files in the Data Explorer or
file conversion tools (e.g. `OGSFileConverter`):
<i class="far fa-exclamation-triangle"></i> Error message:
```bash
Error XSDError in http://www.opengeosys.org/images/xsd/OpenGeoSysCND.xsd, at line 1, column 1: Start tag expected.
Error XSDError in file:///../bc/well.cnd, at line 5, column 195: Loaded schema file is invalid.
XMLInterface::isValid() - XML File is invalid (in reference to schema ./OpenGeoSysCND.xsd).
Error XSDError in http://www.opengeosys.org/images/xsd/OpenGeoSysCND.xsd, at line 1, column 1: Start tag expected.
```
<i class="far fa-arrow-right"></i> Solution:
Open the affected file (e.g. `well.cnd` in this case) in a text editor and remove the following parameter of the XML root
element (the first element in `< >`-brackets in the element, e.g. `<OpenGeoSysCND>`):
```xml
xsi:noNamespaceSchemaLocation="http://www.opengeosys.org/images/xsd/OpenGeoSysXXX.xsd"
```
where `XXX` can be `CND`, `GLI`, `PRJ` or `STN` depending on the file type.
Now the save the modified file and try to load it again.
<!-- vale off -->
<details>
<summary>Background info:</summary>
The XSD files may be downloaded from a web location. We changed the protocol of our web site to `https://` but due to some weird behaviour of the Qt XML validation code it tries to download the file (even if it is available locally) and does not respect the URL redirection to `https://` of the web server. Simply removing the part solves the problem. The XML is still validated! Newer OGS versions do not write that parameter into files anymore, see [!2198](https://github.com/ufz/ogs/pull/2198).
</details>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment