GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: fx_directory_local_path_get.c Lines: 8 8 100.0 %
Date: 2026-03-06 18:49:02 Branches: 4 4 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
10
 **************************************************************************/
11
12
13
/**************************************************************************/
14
/**************************************************************************/
15
/**                                                                       */
16
/** FileX Component                                                       */
17
/**                                                                       */
18
/**   Directory                                                           */
19
/**                                                                       */
20
/**************************************************************************/
21
/**************************************************************************/
22
23
#define FX_SOURCE_CODE
24
25
26
/* Include necessary system files.  */
27
28
#include "fx_api.h"
29
#include "fx_system.h"
30
#include "fx_file.h"
31
#include "fx_utility.h"
32
#include "fx_directory.h"
33
34
#ifndef FX_NO_LOCAL_PATH
35
FX_LOCAL_PATH_SETUP
36
#endif
37
38
/**************************************************************************/
39
/*                                                                        */
40
/*  FUNCTION                                               RELEASE        */
41
/*                                                                        */
42
/*    _fx_directory_local_path_get                        PORTABLE C      */
43
/*                                                           6.1.5        */
44
/*  AUTHOR                                                                */
45
/*                                                                        */
46
/*    William E. Lamie, Microsoft Corporation                             */
47
/*                                                                        */
48
/*  DESCRIPTION                                                           */
49
/*                                                                        */
50
/*    This function returns a pointer to the local default directory      */
51
/*    for this thread.                                                    */
52
/*                                                                        */
53
/*  INPUT                                                                 */
54
/*                                                                        */
55
/*    media_ptr                             Media control block pointer   */
56
/*    return_path_name                      Return local path name        */
57
/*                                                                        */
58
/*  OUTPUT                                                                */
59
/*                                                                        */
60
/*    return status                                                       */
61
/*                                                                        */
62
/*  CALLS                                                                 */
63
/*                                                                        */
64
/*    None                                                                */
65
/*                                                                        */
66
/*  CALLED BY                                                             */
67
/*                                                                        */
68
/*    Application Code                                                    */
69
/*                                                                        */
70
/**************************************************************************/
71
7
UINT  _fx_directory_local_path_get(FX_MEDIA *media_ptr, CHAR **return_path_name)
72
{
73
74
75
#ifndef FX_MEDIA_STATISTICS_DISABLE
76
77
    /* Increment the number of times this service has been called.  */
78
7
    media_ptr -> fx_media_directory_local_path_gets++;
79
#endif
80
81
    /* Check the media to make sure it is open.  */
82
7
    if (media_ptr -> fx_media_id != FX_MEDIA_ID)
83
    {
84
85
        /* Return the media not opened error.  */
86
2
        return(FX_MEDIA_NOT_OPEN);
87
    }
88
89
#ifdef FX_NO_LOCAL_PATH
90
91
    FX_PARAMETER_NOT_USED(return_path_name);
92
93
    /* Error, return to caller.  */
94
    return(FX_NOT_IMPLEMENTED);
95
#else
96
97
    /* Determine if there is a local path.  */
98
5
    if (_tx_thread_current_ptr -> tx_thread_filex_ptr)
99
    {
100
101
        /* Return a pointer to the current local directory path string.  */
102
3
        *return_path_name =  ((FX_LOCAL_PATH *)_tx_thread_current_ptr -> tx_thread_filex_ptr) -> fx_path_string;
103
    }
104
    else
105
    {
106
107
        /* Just set the return value to FX_NULL to indicate there is no
108
           local path setup.  */
109
2
        *return_path_name =  FX_NULL;
110
    }
111
112
    /* If trace is enabled, insert this event into the trace buffer.  */
113
    FX_TRACE_IN_LINE_INSERT(FX_TRACE_DIRECTORY_LOCAL_PATH_GET, media_ptr, return_path_name, 0, 0, FX_TRACE_DIRECTORY_EVENTS, 0, 0)
114
115
    /* Local default directory has been returned, return status.  */
116
5
    return(FX_SUCCESS);
117
#endif
118
}
119