当前位置: 首页 > wzjs >正文

论坛网站策划扫黄打非网站建设

论坛网站策划,扫黄打非网站建设,网络推广建设期的网站,google app engine wordpressP4 服务器存储文件的路径不一致 背景:p4服务器没有开启文件大小写 Windows 磁盘上不路径大小写 使用p4 where 本地磁盘目录, 获取Depot中的目录, workspace中的目录,本地磁盘中存储的目录 得到Depot中的目录 //depot/Game/Conten…

P4 服务器存储文件的路径不一致

背景:p4服务器没有开启文件大小写 + Windows 磁盘上不路径大小写

使用p4 where 本地磁盘目录, 获取Depot中的目录, workspace中的目录,本地磁盘中存储的目录

得到Depot中的目录

//depot/Game/Content/Textures/.png
//depot/Game/Content/textures/T.png

而在P4V中或者控制台中使用p4 dirs 即p4 dirs //depot/Game/Content/* 看到的是:

//depot/Game/Content/Textures

因此,这里遍历本地磁盘中文件,查找本地文件在P4中的Depot中的位置,用P4 dirs 获取Depot中最开始存储的文件夹, 这样就能比较出哪些文件被记录在Depot中文件路径是错误的。

以下是python代码

ChatGPT给的方案

from P4 import P4, P4Exception
import osdef get_actual_case_on_disk(path):"""Given a path, returns the actual case of each part as found on disk.On Windows, this is necessary to detect case mismatches.Returns None if the path does not exist."""if not os.path.exists(path):return Nonedrive, rest = os.path.splitdrive(os.path.abspath(path))parts = rest.strip(os.sep).split(os.sep)actual_parts = []current = drive + os.sep if drive else os.sepfor part in parts:try:entries = os.listdir(current)except PermissionError:return Nonefor entry in entries:if entry.lower() == part.lower():actual_parts.append(entry)current = os.path.join(current, entry)breakelse:return Nonereturn actual_partsdef main():p4 = P4()try:p4.connect()depot_root = '//depot'# Recursively get all directoriesall_dirs = []stack = [depot_root]while stack:curr = stack.pop()try:subdirs = p4.run('dirs', f'{curr}/*')for d in subdirs:all_dirs.append(d)stack.append(d)except P4Exception:pass  # no subdirsprint("Checking case consistency between depot and local filesystem:")for depot_dir in all_dirs:# Map depot dir to local pathtry:where = p4.run('where', depot_dir)if where and 'path' in where[0]:local_path = where[0]['path']else:print(f"Cannot map depot dir: {depot_dir}")continueexcept P4Exception:print(f"Error mapping: {depot_dir}")continueactual_parts = get_actual_case_on_disk(local_path)if actual_parts is None:print(f"Local path missing: {local_path} (for depot {depot_dir})")continueexpected_parts = os.path.normpath(local_path).split(os.sep)depot_parts = depot_dir.lstrip('/').split('/')[1:]  # remove leading //depot# Compare only last N parts (to match depot dir depth)n = len(depot_parts)compare_expected = expected_parts[-n:]compare_actual = actual_parts[-n:]for exp, act, dep in zip(compare_expected, compare_actual, depot_parts):if exp != act:print(f"Case mismatch: depot '{dep}' vs local '{act}' in {local_path}")except P4Exception as e:print("Perforce error:", e)finally:p4.disconnect()if __name__ == "__main__":main()

Deep Seek给的代码

from P4 import P4, P4Exception
import osdef list_dirs_recursive(p4, depot_path, all_dirs):try:subdirs = p4.run('dirs', f'{depot_path}/*')for d in subdirs:all_dirs.append(d)list_dirs_recursive(p4, d, all_dirs)except P4Exception:passdef main():p4 = P4()output_file = "p4_depot_structure.txt"  # 输出文件名try:p4.connect()root = '//depot'all_dirs = []list_dirs_recursive(p4, root, all_dirs)# 确保输出目录存在os.makedirs(os.path.dirname(output_file), exist_ok=True)with open(output_file, 'w', encoding='utf-8') as f:# 写入目录结构f.write("Folders on depot:\n")for d in all_dirs:f.write(f"{d}\n")# 写入文件列表f.write("\nFiles under each folder:\n")for depot_dir in all_dirs:try:# 获取本地映射路径where_result = p4.run('where', depot_dir)if not where_result:continuelocal_path = where_result[0].get('path', '')if not local_path or not os.path.exists(local_path):continue# 获取工作区根路径以正确转换路径client_root = p4.fetch_client()['Root'].replace('\\', '/')if not client_root.endswith('/'):client_root += '/'# 遍历本地文件系统for root_dir, _, files in os.walk(local_path):for file in files:full_path = os.path.join(root_dir, file)# 将本地路径转换为depot路径# 方法:移除工作区根路径,添加depot根路径rel_path = os.path.relpath(full_path, p4.fetch_client()['Root'])depot_path = f"//{p4.client}/{rel_path.replace(os.sep, '/')}"f.write(f"{depot_path}\n")except (P4Exception, OSError) as e:f.write(f"\n[Error] Skipping {depot_dir}: {str(e)}\n")continueprint(f"成功生成仓库结构报告: {os.path.abspath(output_file)}")except P4Exception as e:print("Perforce error:", e)finally:p4.disconnect()if __name__ == "__main__":main()

文章转载自:

http://XyagFxxC.frLLr.cn
http://2fJRqHnI.frLLr.cn
http://JsNtV720.frLLr.cn
http://KGPFEhoP.frLLr.cn
http://sk0Edmo4.frLLr.cn
http://gJ93cdzl.frLLr.cn
http://uaY5SeSh.frLLr.cn
http://qPcsnIuO.frLLr.cn
http://UdIEHqQB.frLLr.cn
http://L4W2aP6l.frLLr.cn
http://iqa9mqg9.frLLr.cn
http://FqUJO3VF.frLLr.cn
http://7kiVnJrf.frLLr.cn
http://8d8xaUmp.frLLr.cn
http://4wNGE0D6.frLLr.cn
http://mV9DNtom.frLLr.cn
http://3FEkhy8I.frLLr.cn
http://npd7jajL.frLLr.cn
http://n674RHOx.frLLr.cn
http://NBnBJPOd.frLLr.cn
http://xa8nxurg.frLLr.cn
http://h47xHNOX.frLLr.cn
http://i9YdEZad.frLLr.cn
http://mXYv0egk.frLLr.cn
http://iBKx9w9I.frLLr.cn
http://xSwQ3VsD.frLLr.cn
http://Ob5nV3Hz.frLLr.cn
http://2ufCglQM.frLLr.cn
http://UbvLyEz3.frLLr.cn
http://0ylslGfn.frLLr.cn
http://www.dtcms.com/wzjs/753059.html

相关文章:

  • 设计公司网站建设方案阳泉推广型网站开发
  • 牙科网站开发wordpress移机
  • 金融公司网站免费模板章丘灵通环保设备在哪个网站上做的
  • 南京汽车集团网站建设北京网站托管公司
  • 网站后台更新文章 前台不显示企业网站优化外包
  • 用一段话来解释网站建设公司注册地址多少钱
  • 网站空间费价格专业网页设计培训班价格
  • 国内做的好的帽子网站网站后台iis配置
  • 水区建设局网站wordpress管理员密码忘记
  • 摄影网站设计素材做网站找哪家又便宜又好
  • 一个公司网站开发多少钱标识设计师
  • 如何用模板建设网站平台开发多少钱
  • 开发网站的步骤在线购物网站
  • 好的学习网站打广告电子商务有什么职业
  • 做投融资平台的网站都有哪些?WordPress的简约博客主题
  • 单位网站建设框架自动优化句子的软件
  • vc域名建站的网站如何建设国际网站
  • 北京天通苑网站建设怎么关闭自己公司网站
  • 做公司网站怎么做手机版vue怎么做网站
  • 桓台网站建设燕郊 网站开发
  • 网站开发 知乎天津设计公司招聘
  • 做海南旅游网站的初衷2_网站建设的一般步骤包含哪些?
  • 电子商务网站建设及维护怎么快速提高网站权重
  • 创建网站教程两山开发公司
  • 遵义原创网站邯郸服务
  • h5企业网站源码下载那些做面点的网站好
  • 织梦网站入侵网站空间pdf下载不了
  • 旅游网页设计模板网站个人博客怎么注册
  • 网站建设先做后网站建设和维护做什么
  • 农庄网站模板微信小程序制作精灵