|
156 | 156 | "def _mac_find_path(_dir=None):\n", |
157 | 157 | " \"\"\"\n", |
158 | 158 | " Attempt to find Stata path on macOS when not on user's PATH.\n", |
159 | | - " Modified from stata_kernel's original to only location \"Applications/Stata\". \n", |
| 159 | + " Modified from stata_kernel's original to \"/Applications/StataNow\" and \"/Applications/Stata\".\n", |
160 | 160 | "\n", |
161 | 161 | " Returns:\n", |
162 | 162 | " (str): Path to Stata. Empty string if not found.\n", |
163 | 163 | " \"\"\"\n", |
164 | 164 | " if _dir is None:\n", |
165 | | - " _dir = '/Applications/Stata'\n", |
166 | | - " path = Path(_dir)\n", |
167 | | - " if not os.path.exists(path):\n", |
168 | | - " return ''\n", |
| 165 | + " dirs = [r'/Applications/StataNow',\n", |
| 166 | + " r'/Applications/Stata']\n", |
169 | 167 | " else:\n", |
170 | | - " try:\n", |
171 | | - " # find the application with the suffix .app\n", |
172 | | - " # example path: /Applications/Stata/StataMP.app\n", |
173 | | - " return str(next(path.glob(\"Stata*.app\")))\n", |
174 | | - " except StopIteration:\n", |
175 | | - " return ''" |
| 168 | + " dirs = [_dir] \n", |
| 169 | + " for this_dir in dirs:\n", |
| 170 | + " path = Path(this_dir)\n", |
| 171 | + " if os.path.exists(path):\n", |
| 172 | + " try:\n", |
| 173 | + " # find the application with the suffix .app\n", |
| 174 | + " # example path: /Applications/Stata/StataMP.app\n", |
| 175 | + " return str(next(path.glob(\"Stata*.app\")))\n", |
| 176 | + " except StopIteration:\n", |
| 177 | + " return ''" |
176 | 178 | ] |
177 | 179 | }, |
178 | 180 | { |
|
0 commit comments