comparison mupdf-source/thirdparty/tesseract/nsis/winpath.cpp @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 // Copyright (C) 2024 Stefan Weil
2 //
3 // SPDX-License-Identifier: Apache-2.0
4 //
5 // winpath - run a Windows program with extended PATH
6 //
7 // Usage:
8 //
9 // winpath [CMD [ARGUMENT ...]]
10 //
11 // Example:
12 //
13 // winpath cmd
14 //
15 // This will start a Windows command line with PATH extended by
16 // the location of the winpath executable.
17
18 #include <process.h> // _spawnvp
19 #include <stdlib.h> // _putenv_s
20 #include <string.h> // strcpy, strcat
21
22 static char path[4096];
23
24 int main(int argc, char *argv[]) {
25 if (argc > 1) {
26 char *dir = argv[0];
27 char *last = strrchr(dir, '\\');
28 if (last != nullptr) {
29 *last = '\0';
30 }
31 strcpy(path, dir);
32 strcat(path, ";");
33 strcat(path, getenv("PATH"));
34 _putenv_s("PATH", path);
35 _spawnvp(_P_WAIT, argv[1], argv + 1);
36 //~ _spawnvp(_P_OVERLAY, argv[1], argv + 1);
37 }
38 return 0;
39 }