# # Copyright 2025 The InfiniFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # """ OCR 模块工具函数 """ import os def get_project_base_directory(*args): """ 获取项目根目录 Args: *args: 可选的子路径 Returns: str: 项目根目录路径 """ # 获取当前文件的目录 current_dir = os.path.dirname(os.path.realpath(__file__)) # 返回 ocr 模块的父目录(项目根目录) base_dir = os.path.dirname(current_dir) if args: return os.path.join(base_dir, *args) return base_dir