fix baseline build (old cairo) - 'cairo_rectangle_int_t' does not name a type
[LibreOffice.git] / desktop / win32 / source / unoinfo.cxx
blob5af29df90af7cc2c6253b5cfe89498b968594856
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include <cstddef>
21 #include <stdio.h>
22 #include <stdlib.h>
23 #include <wchar.h>
25 #define WIN32_LEAN_AND_MEAN
26 #if defined _MSC_VER
27 #pragma warning(push, 1)
28 #endif
29 #include <windows.h>
30 #if defined _MSC_VER
31 #pragma warning(pop)
32 #endif
34 #include <tools/pathutils.hxx>
36 #define MY_LENGTH(s) (sizeof (s) / sizeof *(s) - 1)
37 #define MY_STRING(s) (s), MY_LENGTH(s)
39 namespace {
41 wchar_t * getBrandPath(wchar_t * path) {
42 DWORD n = GetModuleFileNameW(NULL, path, MAX_PATH);
43 if (n == 0 || n >= MAX_PATH) {
44 exit(EXIT_FAILURE);
46 return tools::filename(path);
49 void writeNull() {
50 if (fwrite("\0\0", 1, 2, stdout) != 2) {
51 exit(EXIT_FAILURE);
55 void writePath(
56 wchar_t const * frontBegin, wchar_t const * frontEnd,
57 wchar_t const * backBegin, std::size_t backLength)
59 wchar_t path[MAX_PATH];
60 wchar_t * end = tools::buildPath(
61 path, frontBegin, frontEnd, backBegin, backLength);
62 if (end == NULL) {
63 exit(EXIT_FAILURE);
65 std::size_t n = (end - path) * sizeof (wchar_t);
66 if (fwrite(path, 1, n, stdout) != n) {
67 exit(EXIT_FAILURE);
73 #ifdef __MINGW32__
74 int main(int argc, char ** argv, char **) {
75 if (argc == 2 && strcmp(argv[1], "c++") == 0) {
76 #else
77 int wmain(int argc, wchar_t ** argv, wchar_t **) {
78 if (argc == 2 && wcscmp(argv[1], L"c++") == 0) {
79 #endif
80 wchar_t path[MAX_PATH];
81 wchar_t * pathEnd = getBrandPath(path);
82 writePath(path, pathEnd, MY_STRING(L""));
83 #ifdef __MINGW32__
84 } else if (argc == 2 && strcmp(argv[1], "java") == 0) {
85 #else
86 } else if (argc == 2 && wcscmp(argv[1], L"java") == 0) {
87 #endif
88 if (fwrite("1", 1, 1, stdout) != 1) {
89 exit(EXIT_FAILURE);
91 wchar_t path[MAX_PATH];
92 wchar_t * pathEnd = getBrandPath(path);
93 writePath(path, pathEnd, MY_STRING(L"classes\\ridl.jar"));
94 writeNull();
95 writePath(path, pathEnd, MY_STRING(L"classes\\jurt.jar"));
96 writeNull();
97 writePath(path, pathEnd, MY_STRING(L"classes\\juh.jar"));
98 writeNull();
99 writePath(path, pathEnd, MY_STRING(L"classes\\unoil.jar"));
100 writeNull();
101 writePath(path, pathEnd, MY_STRING(L""));
102 } else {
103 exit(EXIT_FAILURE);
105 exit(EXIT_SUCCESS);
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */