Page 1 of 1

How to close file by api

Posted: 12.03.2024 09:36
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)

Re: How to close file by api

Posted: 13.03.2024 01:25
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!

Re: How to close file by api

Posted: 13.03.2024 12:31
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.