102 lines
1.3 KiB
ReStructuredText
102 lines
1.3 KiB
ReStructuredText
|
Paths and files
|
||
|
===============
|
||
|
|
||
|
Remember, always import library first.
|
||
|
|
||
|
.. code-block:: python
|
||
|
|
||
|
import easymacro as app
|
||
|
|
||
|
|
||
|
Get info path
|
||
|
-------------
|
||
|
|
||
|
.. code-block:: python
|
||
|
|
||
|
path = '/home/mau/myfile.ods'
|
||
|
p = app.path(path)
|
||
|
|
||
|
app.debug(p.path)
|
||
|
app.debug(p.file_name)
|
||
|
app.debug(p.name)
|
||
|
app.debug(p.ext)
|
||
|
app.debug(p.size)
|
||
|
app.debug(p.url)
|
||
|
|
||
|
.. image:: _static/images/path_01.png
|
||
|
|
||
|
|
|
||
|
|
||
|
Get info like tuple
|
||
|
|
||
|
.. code-block:: python
|
||
|
|
||
|
app.debug(p.info)
|
||
|
|
||
|
.. image:: _static/images/path_02.png
|
||
|
|
||
|
|
|
||
|
|
||
|
Or like dict
|
||
|
|
||
|
.. code-block:: python
|
||
|
|
||
|
app.debug(p.dict)
|
||
|
|
||
|
.. image:: _static/images/path_03.png
|
||
|
|
||
|
|
||
|
Get home path
|
||
|
-------------
|
||
|
|
||
|
.. code-block:: python
|
||
|
|
||
|
p = app.path
|
||
|
app.debug(p.home)
|
||
|
|
||
|
|
||
|
Get documento path
|
||
|
------------------
|
||
|
|
||
|
.. code-block:: python
|
||
|
|
||
|
p = app.path
|
||
|
app.debug(p.documents)
|
||
|
|
||
|
|
||
|
Get temporary directory
|
||
|
-----------------------
|
||
|
|
||
|
.. code-block:: python
|
||
|
|
||
|
p = app.path
|
||
|
app.debug(p.temp_dir)
|
||
|
|
||
|
|
||
|
Get path user profile
|
||
|
---------------------
|
||
|
|
||
|
.. code-block:: python
|
||
|
|
||
|
p = app.path
|
||
|
app.debug(p.user_profile)
|
||
|
|
||
|
|
||
|
Get path user config
|
||
|
--------------------
|
||
|
|
||
|
.. code-block:: python
|
||
|
|
||
|
p = app.path
|
||
|
app.debug(p.user_config)
|
||
|
|
||
|
|
||
|
Get python executable path
|
||
|
--------------------------
|
||
|
|
||
|
.. code-block:: python
|
||
|
|
||
|
p = app.path
|
||
|
app.debug(p.python)
|
||
|
|