好的,這是問題所在。我正在嘗試獲取已安裝的應用程序和版本的數組。將應用程序日誌文本文件解析爲數組。
到目前爲止,我所發現的是,我可以運行此命令:
system_profiler SPApplicationsDataType > log.txt
哪位能給我以下格式的TXT文件:
Applications:
MacTubes:
Version: 3.1.5
Obtained from: Unknown
Last Modified: 9/15/12, 2:41 AM
Kind: Universal
64-Bit (Intel): No
Location: /Volumes/Storage/MacTubes.app
Boom:
Version: 1.6
Obtained from: Identified Developer
Last Modified: 10/12/12, 3:24 AM
Kind: Intel
64-Bit (Intel): No
Signed by: Developer ID Application: Global Delight Technologies Pvt. Ltd, Developer ID Certification Authority, Apple Root CA
Location: /Volumes/Storage/Boom.app
Get Info String: 1.6 Copyright © 2008 - 2012, Global Delight Technologies Pvt. Ltd.
World of Goo:
Version: 1.30
Obtained from: Unknown
Last Modified: 2/8/10, 8:43 AM
Kind: Universal
64-Bit (Intel): No
Location: /Volumes/Storage/Misc/World of Goo.app
Get Info String: 1.30, Copyright © 2008 2D Boy LLC
VZAccess Manager:
Version: 4.3.0
Obtained from: Unknown
Last Modified: 12/17/09, 8:48 PM
Kind: Universal
64-Bit (Intel): No
Location: /Volumes/Storage/Misc/VZAccess Manager.app
Get Info String: VZAccess Manager 4.3.0 Copyright © 2000-2008 Smith Micro Software, Inc.
ColorSync:
Obtained from: Unknown
Last Modified: 10/9/00, 12:00 PM
Kind: Classic
Location: /Volumes/Storage/Misc/System Folder/Control Panels/ColorSync
AppleTalk:
Obtained from: Unknown
Last Modified: 10/1/96, 12:00 PM
Kind: Classic
Location: /Volumes/Storage/Misc/System Folder/Control Panels/AppleTalk
我希望能夠到採取應用程序名稱和版本號,並將它們以某種方式存儲在一個數組中。由於所有參賽作品對我來說都是一樣的,我不知道該從哪裏開始?我需要忽略沒有版本號的條目。
你使用什麼編程語言? – bdesham
如果可以,我想使用C++,但不管哪種語言最簡單。我想我可以讓問題變得更簡單,我找到了一個他們正在做類似事情的舊帖子,但它並沒有給我帶來他們得到的結果。 http://hintsforums.macworld.com/archive/index.php/t-109990.html如果我能把它變成名稱:版本的格式,它會使分析變得更簡單。然而,他們所做的並不是爲我工作,我需要獲取所有應用程序,而不僅僅是某些應用程序。 – Macuserman17