findsofficepath.c (3889e2e9) findsofficepath.c (2e9bc605)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 103 unchanged lines hidden (view full) ---

112
113 return path;
114}
115
116#else
117
118#include <unistd.h>
119#include <limits.h>
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 103 unchanged lines hidden (view full) ---

112
113 return path;
114}
115
116#else
117
118#include <unistd.h>
119#include <limits.h>
120
120#include <stdio.h>
121/*
122 * Gets the installation path from the PATH environment variable.
123 *
124 * <p>An installation is found, if the executable 'soffice' or a symbolic link
125 * is in one of the directories listed in the PATH environment variable.</p>
126 *
127 * @return the installation path or NULL, if no installation was found or
128 * if an error occured

--- 11 unchanged lines hidden (view full) ---

140 char* dir = NULL;
141 char* file = NULL;
142 char* resolved = NULL;
143 char* sep = NULL;
144
145 char buffer[PATH_MAX];
146 int pos;
147
121/*
122 * Gets the installation path from the PATH environment variable.
123 *
124 * <p>An installation is found, if the executable 'soffice' or a symbolic link
125 * is in one of the directories listed in the PATH environment variable.</p>
126 *
127 * @return the installation path or NULL, if no installation was found or
128 * if an error occured

--- 11 unchanged lines hidden (view full) ---

140 char* dir = NULL;
141 char* file = NULL;
142 char* resolved = NULL;
143 char* sep = NULL;
144
145 char buffer[PATH_MAX];
146 int pos;
147
148 /* get the value of the PATH environment variable */
148#ifdef MACOSX
149 /* On MacOS we have no soffice link under /usr/bin but the default office location is known
150 and we check this only
151 */
152 const char* MACDEFAULTOFFICEPATH = "/Applications/OpenOffice.app/Contents/MacOS";
153 const char* MACDEFAULTSOFFICE = "/Applications/OpenOffice.app/Contents/MacOS/soffice";
154
155 if ( !access( MACDEFAULTSOFFICE, F_OK ) )
156 {
157 path = (char*) malloc( MACDEFAULTOFFICEPATH + 1 );
158 strcpy( path, MACDEFAULTOFFICEPATH);
159 }
160 return path;
161#else
162/* get the value of the PATH environment variable */
149 env = getenv( PATHVARNAME );
150 str = (char*) malloc( strlen( env ) + 1 );
151 strcpy( str, env );
152
153 /* get the tokens separated by ':' */
154 dir = strtok( str, PATHSEPARATOR );
155
156 while ( dir )

--- 28 unchanged lines hidden (view full) ---

185
186 dir = strtok( NULL, PATHSEPARATOR );
187 free( file );
188 }
189
190 free( str );
191
192 return path;
163 env = getenv( PATHVARNAME );
164 str = (char*) malloc( strlen( env ) + 1 );
165 strcpy( str, env );
166
167 /* get the tokens separated by ':' */
168 dir = strtok( str, PATHSEPARATOR );
169
170 while ( dir )

--- 28 unchanged lines hidden (view full) ---

199
200 dir = strtok( NULL, PATHSEPARATOR );
201 free( file );
202 }
203
204 free( str );
205
206 return path;
207#endif
193}
194
195#endif
196
197char const* cppuhelper_detail_findSofficePath()
198{
199 const char* UNOPATHVARNAME = "UNO_PATH";
200

--- 12 unchanged lines hidden ---
208}
209
210#endif
211
212char const* cppuhelper_detail_findSofficePath()
213{
214 const char* UNOPATHVARNAME = "UNO_PATH";
215

--- 12 unchanged lines hidden ---