How to close file by api

Post Reply
SamC
Posts: 207
Joined: 12.08.2023 00:49

How to close file by api

Post by SamC »

Hello,
We can use file_open to open file in cuda,can we close file using similar method? I didn't find the associated method in API.
Thanks!

Code: Select all

def file_open(name, group=-1, options=''):
    if isinstance(name, (list, tuple)):
        if len(name)<2:
            raise ValueError('Length of "name" param must be >=2')
        if type(name[0]) is not str:
            raise ValueError('Param name[0] must be str')
        if type(name[1]) is not str:
            raise ValueError('Param name[1] must be str')
        return ct.file_open(name[0], name[1], group, options)
    else:
        return ct.file_open(name, '', group, options)
SamC
Posts: 207
Joined: 12.08.2023 00:49

Re: How to close file by api

Post by SamC »

I find the method Editor(h).cmd(cmd_FileClose) can close file.
Generally, most frequencyly used method are decorated from ed.cmd() to ed.xxx()(like ed.save())?
Thanks!
main Alexey
Posts: 2245
Joined: 25.08.2021 18:15

Re: How to close file by api

Post by main Alexey »

yes, correct: ed.cmd(cmd_FileClose) .
cmd_FileClose is declared in the module cudatext_cmd.
not all methods are 'decorated' to separate names. closing-method is not.
Post Reply