我一直在使用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的末尾和相对路径之间。再一次,这个问题以前不是问题,我不确定它现在是什么。