2012-08-09 22 views
0

我一直在使用Contribute的File Deployer工具一段時間,直到我們替換了將文件推送到的服務器之後,它才奏效。本身推送文件工作正常,權限和所有。但是其主要功能的一部分是掃描文件被推送到的目錄,如果它不存在,則會創建所述目錄。在Contribute File Deployer上寫入權限問題?

截至目前,在這部分工具上總是失敗。被推文件的完整路徑的格式是\\\x.x.x.x\sync$\path/to/folder(混合斜線始終工作)

這是Windows XP SP3使用ColdFusion 8

<cftry> 
      <cfinvoke method="MakeSurePathExists" path="#serverPathToPush##siteRelative#"> 
      <cfcatch type="any"> 
       <cfthrow errorcode="NoLiveServerAccess" message="Can not access or do not have sufficient permissions to write to: #serverPathToPush##siteRelative#"> 
       <cflog application="yes" text="Can not access or do not have sufficient permissions to write to: #serverPathToPush##siteRelative#" file="Filedeployer" /> 
      </cfcatch> 
     </cftry> 

    <cffile action="copy" source="#settings.stagingFileSystemPath & siteRelative#" destination="#serverPathToPush##siteRelative#"> 
    <!--- touch the file so it gets the current date, so the browser will pull down the new one when previewed ---> 
    <cffile action="append" file="#serverPathToPush##siteRelative#" output=""> 

<!--- This function checks if the directory exist of the given file. 
     If it doesn't, it tries to build path. If it fails, the function throws ---> 
    <cffunction name="MakeSurePathExists"> 
     <cfargument name="path" type="string" required="true"> 

     <cfset createList = ArrayNew(1)> 
     <cfinvoke method="RemoveLastFileFromPath" path="#path#" returnvariable="parentdir"> 

     <cfloop condition="not DirectoryExists(parentDir) and Len(parentDir) gt 0 "> 
      <cfset temp = ArrayAppend(createList, parentDir) > 
      <cfinvoke method="RemoveLastFileFromPath" path="parentdir" returnvariable="parentdir"> 
     </cfloop> 

     <cfloop from="#ArrayLen(createList)#" to="1" step="-1" index="index"> 
      <cfdirectory action="create" directory="#createList[index]#"> 
     </cfloop> 
    </cffunction> 

    <cfscript> 

     function RemoveLastFileFromPath(path) 
     { 
      rpath = Reverse(path) ; 
      idx2 = Find("\", rpath) ; 
      idx = Find("/", rpath) ; 
      if(idx2 is not "0" and idx2 lt idx) 
       idx = idx2 ; 
      if(idx is not "0") { 
       rpath = Right(rpath, Len(rpath) - idx) ; 
       return Reverse(rpath) ; 
      } 
      return "" ; 
     } 
    </cfscript> 

友好的錯誤,我得到的是:

Can not access or do not have sufficient permissions to write to: \x.x.x.x.\sync$\ path/to/folder/the-file.cfm

CFDUMP的錯誤:

The most likely cause of this error is that \x.x.x.x.\sync$\ path/to/folder/already exists on your file system. The exception occurred during a cfdirectory action="create".

我知道了SPAC的e在共享URL的末尾和相對路徑之間。再一次,這個問題以前不是問題,我不確定它現在是什麼。

回答

1

事實證明,在這種情況下,URL中的空間正在影響推送。我不得不在服務器地址周圍添加一個trim(),並解決了這個問題。然而,爲什麼它現在只是一個問題,而不是我永遠不會知道的。