You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
808 B
26 lines
808 B
|
7 days ago
|
# -*- coding: utf-8 -*-
|
||
|
|
"""票 04:定位 mvn 安装位置。"""
|
||
|
|
import os, sys, io, glob
|
||
|
|
sys.stdout = io.TextIOWrapper(sys.stdout.buffer, encoding='utf-8')
|
||
|
|
|
||
|
|
pats = [
|
||
|
|
r'C:\Program Files\apache-maven*',
|
||
|
|
r'C:\Program Files (x86)\apache-maven*',
|
||
|
|
r'C:\apache-maven*',
|
||
|
|
r'D:\*maven*',
|
||
|
|
r'E:\*maven*',
|
||
|
|
r'C:\Users\Administrator\*maven*',
|
||
|
|
r'C:\Users\Administrator\scoop\apps\maven*',
|
||
|
|
r'C:\tools\*maven*',
|
||
|
|
]
|
||
|
|
found = []
|
||
|
|
for p in pats:
|
||
|
|
found += [g for g in glob.glob(p) if os.path.isdir(g)]
|
||
|
|
print('glob hits:', found)
|
||
|
|
print('M2_HOME =', os.path.expandvars(r'%M2_HOME%'))
|
||
|
|
print('MAVEN_HOME =', os.path.expandvars(r'%MAVEN_HOME%'))
|
||
|
|
print('PATH entries w/ maven:')
|
||
|
|
for e in os.environ.get('PATH', '').split(';'):
|
||
|
|
if 'maven' in e.lower() or 'mvn' in e.lower():
|
||
|
|
print(' ', e)
|