summaryrefslogtreecommitdiffstats
path: root/meta/lib/oeqa/core/utils/path.py
blob: c086dcb0b04f14324ee783be980618564c01df4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#
# Copyright (C) 2016 Intel Corporation
#
# SPDX-License-Identifier: MIT
#

import os
import sys

def findFile(file_name, directory):
    """
        Search for a file in directory and returns its complete path.
    """
    for r, d, f in os.walk(directory):
        if file_name in f:
            return os.path.join(r, file_name)
    return None

def remove_safe(path):
    if os.path.exists(path):
        os.remove(path)