{"id":1088,"date":"2014-10-31T16:15:10","date_gmt":"2014-10-31T08:15:10","guid":{"rendered":"http:\/\/blog.qdac.cc\/?p=1088"},"modified":"2014-10-31T16:15:10","modified_gmt":"2014-10-31T08:15:10","slug":"%e5%9c%a8andriod%e7%a8%8b%e5%ba%8f%e4%b8%ad%e8%8e%b7%e5%8f%96%e5%a4%96%e7%bd%aesd%e5%8d%a1%e6%a0%b9%e7%9b%ae%e5%bd%95","status":"publish","type":"post","link":"https:\/\/blog.qdac.cc\/?p=1088","title":{"rendered":"\u5728Andriod\u7a0b\u5e8f\u4e2d\u83b7\u53d6\u5916\u7f6eSD\u5361\u6839\u76ee\u5f55"},"content":{"rendered":"<p>\u6211\u4eec\u77e5\u9053\uff0cAndriod\u662f\u57fa\u4e8eLinux\u7684\uff0c\u6240\u4ee5\u6b63\u5e38\u7684\u5b58\u8d2e\u8bbe\u5907\u90fd\u88ab\u6302\u8f7d\u5230\/mnt\u76ee\u5f55\u4e0b\uff0c\u6211\u4eec\u67e5\u627eSD\u5361\u6839\u76ee\u5f55\u5c31\u662f\u8981\u5728\u4e0b\u9762\u627e\u5230\u90a3\u4e2a\u5361\u662f\u5916\u7f6e\u7684SD\u5361\uff0c\u4f46\u9057\u61be\u7684\u662f\uff0c\u76ee\u524d\u6ca1\u6709\u4e00\u79cd\u6807\u51c6\u7684\u65b9\u6cd5\u6765\u505a\u5230\u8fd9\u4e00\u70b9\uff08\u5305\u62ecAndriod\u672c\u8eab\uff09\u3002\u4e0b\u9762\u6211\u4e3a\u5927\u5bb6\u63d0\u4f9b\u4e86\u4e00\u4e2a\u51fd\u6570\u6765\u5b8c\u6210\u8fd9\u4e00\u529f\u80fd\uff1a<\/p>\n<pre class=\"lang:delphi decode:true\">function GetExtSDDir: String;\r\n  var\r\n    AList: TStringDynArray;\r\n    S: String;\r\n    I, J, ALastNo, ANo: Integer;\r\n  const\r\n    ExtSDCardNames: array [0 .. 7] of String = ('\/mnt\/ext_sdcard',\r\n      '\/mnt\/extsd',\r\n      '\/mnt\/ext_card',\r\n      '\/mnt\/external_sd',\r\n      '\/mnt\/ext_sd',\r\n      '\/mnt\/external',\r\n      '\/mnt\/extSdCard',\r\n      '\/mnt\/externalSdCard'\r\n      );\r\n  begin\r\n  Result := '';\r\n  AList := TDirectory.GetDirectories('\/mnt');\r\n  ALastNo := 0;\r\n  for I := 0 to High(AList) do\r\n    begin\r\n    S := AList[I];\r\n    for J := 0 to High(ExtSDCardNames) do\r\n      begin\r\n      if S = ExtSDCardNames[J] then\r\n        begin\r\n        Result := S + '\/';\r\n        Exit;\r\n        end\r\n      end;\r\n    if StartWithW(PWideChar(S),'\/mnt\/sdcard', False) then\r\n      begin\r\n      if TryStrToInt(RightStrW(AList[I], Length(AList[I]) - 11, False), ANo)\r\n      then\r\n        begin\r\n        if ANo &gt; ALastNo then\r\n          begin\r\n          ALastNo := ANo;\r\n          Result := AList[I] + '\/';\r\n          end;\r\n        end;\r\n      end;\r\n    end;\r\n  end;<\/pre>\n<p>\u8fd9\u4e2a\u51fd\u6570\u4f7f\u7528\u4e86QString.pas\u5355\u5143\u7684StartWithW\u548cRightStrW\u4e24\u4e2a\u51fd\u6570\uff0cTDirectory\u5bf9\u8c61\u9700\u8981\u5f15\u5165ioutils\u5355\u5143\u3002ExtSDCardNames\u5e38\u91cf\u5b9a\u4e49\u4e86\u76ee\u524d\u5df2\u7ecf\u7684SD\u5361\u6839\u76ee\u5f55\u7684\u6302\u8f7d\u540d\u79f0\uff0c\u53ef\u80fd\u8fd8\u6709\u66f4\u591a\uff0c\u5982\u679c\u4f60\u53d1\u73b0\u4e86\uff0c\u53ef\u4ee5\u968f\u65f6\u8865\u5145\u5c31\u597d\u3002\u5728\u627e\u4e0d\u5230\u4e0a\u8ff0\u5173\u952e\u8bcd\u65f6\uff0c\u4f1a\u5c1d\u8bd5\u641c\u7d22sdcard1\/sdcard2\u8fd9\u6837\u7684\u76ee\u5f55\uff0c\u5e76\u53d6\u5176\u4e2d\u6700\u5927\u7684\u90a3\u4e2a\u503c\u4e3aSD\u5361\u7684\u6839\u76ee\u5f55\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6211\u4eec\u77e5\u9053\uff0cAndriod\u662f\u57fa\u4e8eLinux [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"default","site-content-layout":"","ast-site-content-layout":"default","site-content-style":"default","site-sidebar-style":"default","ast-global-header-display":"","ast-banner-title-visibility":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","ast-disable-related-posts":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","astra-migrate-meta-layouts":"default","ast-page-background-enabled":"default","ast-page-background-meta":{"desktop":{"background-color":"var(--ast-global-color-4)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"ast-content-background-meta":{"desktop":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"tablet":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""},"mobile":{"background-color":"var(--ast-global-color-5)","background-image":"","background-repeat":"repeat","background-position":"center center","background-size":"auto","background-attachment":"scroll","background-type":"","background-media":"","overlay-type":"","overlay-color":"","overlay-opacity":"","overlay-gradient":""}},"footnotes":""},"categories":[69,8,21],"tags":[457,146,147],"class_list":["post-1088","post","type-post","status-publish","format-standard","hentry","category-c-builder","category-delphi","category-misc","tag-android","tag-sd","tag-147"],"views":5619,"_links":{"self":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1088","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1088"}],"version-history":[{"count":1,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1088\/revisions"}],"predecessor-version":[{"id":1089,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=\/wp\/v2\/posts\/1088\/revisions\/1089"}],"wp:attachment":[{"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1088"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1088"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.qdac.cc\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1088"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}